Toad World® Forums

(14.051.637) Problems with PLSQL Formatter

Hi,

PLSql formatter seems lost when using new syntax (since Oracle 18c) for initializing records and arrays like this:

DECLARE
TYPE ints_t IS TABLE OF INTEGER
INDEX BY PLS_INTEGER;

l_ints ints_t := ints_t (1 => 55, 2 => 555, 3 => 5555);
BEGIN
FOR indx IN 1 .. l_ints.COUNT
LOOP
DBMS_OUTPUT.put_line (l_ints (indx));
END LOOP;
END;
/

Regards.

Claude.

Support for this syntax (1 => 55, 2 => 555, etc.) our side is missing indeed.
Thanks for letting us know.

Andre

Hi,

thank you for your reply,

just another example:

DECLARE
TYPE species_rt IS RECORD (
species_name VARCHAR2 (100),
habitat_type VARCHAR2 (100),
surviving_population INTEGER);

l_elephant species_rt
:= species_rt (species_name => 'Elephant',
surviving_population => '10000',
habitat_type => 'Savannah');
BEGIN
DBMS_OUTPUT.put_line ('Species: ' || l_elephant.species_name);
END;
/

regards.

Claude

Hi Claude,

Hmm, your last example seems to parse and format fine in Toad 14.0.75.662, which has the same QP5 component 5.362 as yours. Are you sure there's a problem? If so then can you please provide details?

Thanks,
Andre

Hi,

Yes you were right, this on parses correctly.

but these ones not:
DECLARE
TYPE by_string_t IS TABLE OF INTEGER
INDEX BY VARCHAR2 (100);

l_stuff   by_string_t := by_string_t ('Steven' =>  55, 'Loey'   =>   555, 'Juna'    =>   5555);
l_index   VARCHAR2 (100) := l_stuff.FIRST;

BEGIN
DBMS_OUTPUT.put_line (l_stuff.COUNT);

WHILE l_index IS NOT NULL LOOP
    DBMS_OUTPUT.put_line (l_index || ' => ' || l_stuff (l_index));
    l_index := l_stuff.NEXT (l_index);
END LOOP;

END;
/

DECLARE
TYPE by_string_t IS TABLE OF INTEGER
INDEX BY VARCHAR2 (100);

l_stuff   by_string_t := by_string_t (UPPER ('Grandpa Steven') => 55, 'Loey' || 'Juna' => 555, SUBSTR ('Happy Family', 7) => 5555);

l_index   VARCHAR2 (100) := l_stuff.FIRST;

BEGIN
DBMS_OUTPUT.put_line (l_stuff.COUNT);

WHILE l_index IS NOT NULL LOOP
    DBMS_OUTPUT.put_line (l_index || ' => ' || l_stuff (l_index));
    l_index := l_stuff.NEXT (l_index);
END LOOP;

END;
/

Best regards.

Claude.

That's of a same kind as the first snippet indeed.
Thanks for the examples, we've queued it. (QP-3755)

Thanks,
Andre