Template Wish

Roeland

Member³
Can i execute some code (PL/SQL) (or a Test script/ function) in a Template?

This should make the templates really powerfull.

I have something in mind so that i can substitute the variables in my code with the ones chosen in my template.

syntax:

[
Code:
<= Start code
  :var   <= The same Variables of the template
  Result <= Formatted text that should be inserted at this position
]
 
The only code that can be executed is the SQL of a Query Variable. For example:

Code:
[$QUERY seq_query =
select lower(object_name) from user_objects
where object_type = 'SEQUENCE'
order by object_name]
select [Sequence=$seq_query,...].nextval into [Variable name] from dual;
 
Allright,

But couldn't you guys extend this to execute also some pl/sql in a block that returns a varchar2?

And in that block of code reuse the Query Variables? This shouldn't be to hard, just execute a pl/sql script with the variables obtained from the Query variables?

Example:

Code:
[$QUERY Table_name_low =
select lower(object_name) from user_objects
where object_type = 'TABLE'
order by object_name]

procedure Insert_[Table=$Table_name_low] (
[<CODE>
-- make use of the Query variable (just like scripts)
--Extract all the columns out of the selected table
select ... into :RESULT
from ...
where Name =:[Table=$Table_name_low] ...
--Calculate the length
--make a parameter list
...

--add the insert/update/delete/...

-- write the result in :RESULT (type is varchar2)
</CODE>]
Could this be added to the list of enhancement requests?
 
I would also like to see such a feature.

This would for example allow to format the entered values depending on the max length of the values.

If you implement such a feature, please also provide a variable with the current cursor position where the template will be inserted. This would be great to calculate how much space is left on the line.

Thanks
Patrick
 
Back
Top