Wednesday, June 8, 2011

How to Pass '&' as argument's value

SQL> create or replace procedure test_this_man as
2 a varchar2(100);
3 begin
4 dbms_output.put_line ('Test');
5 a := 'AAA&DDDD';
6 dbms_output.put_line (a);
7* end;
SQL> /
Enter value for dddd: dd
old 5: a := 'AAA&DDDD';
new 5: a := 'AAAdd';

Warning: Procedure created with compilation errors.


To avoid this Error set the scan to off:-

sql> set scan off;

SQL> create or replace procedure test_this_man as
2 a varchar2(100);
3 begin
4 dbms_output.put_line ('Test');
5 a := 'AAA&DDDD';
6 dbms_output.put_line (a);
7* end;
SQL> /

Procedure created.

SQL> set serveroutput on;
SQL> exec test_This_man
Test
AAA&DDDD

No comments:

Post a Comment