Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to pass multiline as input to &

hphanjra-JavaNetFeb 6 2017 — edited Feb 6 2017

If I just enter select * from dual it works fine. But If try multiliner it does not

SQL>
SQL> DECLARE
  2     cur_ SYS_REFCURSOR;
  3
  4     CURSOR get_columns IS
  5        SELECT t2.column_value.getrootelement()         name,
  6               EXTRACTVALUE(t2.column_value, 'node()')  VALUE
  7          FROM (SELECT * FROM TABLE (XMLSEQUENCE(cur_))) t1,
  8                 TABLE (XMLSEQUENCE(EXTRACT(t1.column_value, '/ROW/node()'))) t2;
  9  BEGIN
   OPEN cur_ FOR '&eqf';
10   11
12     FOR rec_ IN get_columns LOOP
13        DBMS_OUTPUT.put_line(rec_.name || ': ' || rec_.VALUE);
14     END LOOP;
15  END;
16  /
Enter value for eqf: select *
old  10:    OPEN cur_ FOR '&eqf';
new  10:    OPEN cur_ FOR 'select *   ';
DECLARE
*
ERROR at line 1:
ORA-00923: FROM keyword not found where expected
ORA-06512: at line 10

SQL> from dual

This post has been answered by mathguy on Feb 6 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 6 2017
Added on Feb 6 2017
7 comments
2,018 views