Toad World® Forums

Improper code completion in execution console


#1

Hi,

Try to generate sqlcode for function returning indexed collection. Package in attachement.
What we can see (try execute this):

1 DECLARE
2 “Return Value” TEST__.TEST_COL;
3 BEGIN

4 – Now call the stored program
5 “Return Value” := test__.run_test;

6 – Output the results
7 IF “Return Value” IS NOT NULL THEN
8 IF “Return Value”.count > 0 THEN
9 FOR i IN “Return Value”.first … “Return Value”.last LOOP
10 IF “Return Value”.exists(i) THEN
11 null; – type of data not known
12 dbms_output.put_line(SubStr(’“Return Value”(’||TO_CHAR(i)||’) = '||“Return Value”(i),1,255));
13 END IF;
14 END LOOP;
15 END IF;
16 END IF;

17 COMMIT;
18 END;

Line 7, indexed collection can’t be checked for null, only 8 line is valid for checking
Line 9 , this iteration is improper for this type of collection, only non indexed collection can be iterated like this. You should use clasical loop, for example:

temp:=“Return Value”.first;
loop
dbms_output.put_line(“Return Value”(temp));
exit when temp=“Return Value”.last;
temp:=“Return Value”.next(temp);
end loop;

-Piter-

test___ddl.sql (387 Bytes)


#2

Hi Piter,

Thanks for your observation. Execution Console will be removed in the next iteration of Beta, but we’ll take your input into account in the new execution facility.

Roman


#3

Hi Piter,

I’ve made a note to test this particular scenario in the new version!!
Thanks for the detail.

  • Jaime -