Hello everyone,
I am an Oracle database admin and developer. So, I code a lot in SQL and PL/SQL. I believe what I am about to ask is valid for any SQL developer. I have read many topics in the forums and documentation. Also, talked to support for few times.
Current UE version I use is 26.10.0.72
My problem is folding with SQL & PL/SQL. UltraEdit code folding tags Open Fold Strings and Close Fold Strings are not defined in pairs as I learned. Whatever I wrote in Open Fold Strings can be fold with any Close Fold Strings tag. These are my folding strings:
Here is a sample PL/SQL pseudo code, has no meaning and may have some minor errors, but is enough to explain my issues:
Here are my issues:
I am an Oracle database admin and developer. So, I code a lot in SQL and PL/SQL. I believe what I am about to ask is valid for any SQL developer. I have read many topics in the forums and documentation. Also, talked to support for few times.
Current UE version I use is 26.10.0.72
My problem is folding with SQL & PL/SQL. UltraEdit code folding tags Open Fold Strings and Close Fold Strings are not defined in pairs as I learned. Whatever I wrote in Open Fold Strings can be fold with any Close Fold Strings tag. These are my folding strings:
Code: Select all
/Open Fold Strings = "{Start}" "begin" "if" "loop" "case" "else" "elsif"
/Close Fold Strings = "{Stop}" "end;" "end if;" "End Loop;" "end case;" "else" "elsif"
Code: Select all
Create or replace function sf_test(p number) as
x1 number;
x2 number;
cursor c is
select *
from employees
where department_id = 50
and salary > 4000
and manager_id <> 120;
begin
x1 := p;
for i in 1..10 loop
Select salary
into x2
from employees
where hire_date < sysdate -10
and department_id in (10,20)
and manager_id is not null
and first_name = 'Mustafa'
and last_name = 'Kal';
if x1 > x2 then
dbms_output.put_line('error');
elsif x1 = x2 then
dbms_output.put_line('interesting');
else
dbms_output.put_line('wow');
end if;
end loop;
end sf_test;
- I need to be able to fold SELECT statements (or any other SQL statements like insert, update, delete, etc. or cursor). select statements can be sometimes over 200 lines or even more and I really need to fold them. In my sample code, line 5 (cursor) and line 17 are start point for select statements. Only way to fold a select statement is adding semicolon into Close Fold Strings, but this will mess everything because in PL/SQL all statements end with semicolon like assignment in line 13 ( x1 := p; ). If I add semicolon to Close Fold Strings, then my first begin at line 11 will be fold with line 13 (assignment) because of any open fold string will be ended by any close fold string. I don't know if this is possible to achieve with current design, but I assume, defining Open and Close Fold Strings in pairs would solve it. First tag in Open Fold Strings should be end with first tag in Close Fold Strings, then my definition cloud be like this:
begin here could be end with both end and exception, whichever comes first in the code.Code: Select all
/Open Fold Strings = "select" "insert" "for loop" "begin" "begin" "exception" ... /Close Fold Strings = ";" ";" "end loop;" "end;" "exception" "end;" ...
Is this possible?
I sent an email to support last year about this and they told me there will be a new enhancement coming that will change the behavior of folding in early 2022. Did this enhancement arrived? (I don't know what it is.) - Can we use wild characters in folding like *? As far as I understand it is not, right? In PL/SQL a function definition could be end with END; or END FUNCTION_NAME;. So I am not able to fold whole function if I use function name at the end (in my sample code last line: end sf_test;) It would be nice defining close fold strings with a wild character and that way I can also add:
or maybe a simple regular expression pattern like:Code: Select all
/Open Fold Strings = "function" /Close Fold Strings = "end *;"
That way exact function name could be match (of course owner name could cause some issues here, function names could have a owner prefix: create function MUSTAFA.SF_TEST, but end of the function must be end sf_test without owner.Code: Select all
/Open Fold Strings = "function \w" /Close Fold Strings = "end \w;"
By asking this, I am aware that, one end point will be used by to start point, first line of sample code could be folded with last line of the code and also begin statement at line 11 could be folded with last line of code.