I want ask you a private qize,please see the folling program,
set serveroutput on 1
p_item_id1 number := 1111 ; 3
p_item_id2 number := 2222 ; 4
p_item_id3 number := 3333 ; 5
cnt number; 6
tmp varchar2(20); 7
for cnt in 1..3 loop 9
tmp := 'p_item_id'|| to_char(cnt) ; 10
dbms_output.put_line( tmp ); 11
-- dbms_output.put_line( &tmp ); 12
end loop ; 13
end ; 14
result (Execute in sqlplus environment):
I want the result as the following:
I used line 12 replaced line 11,but failed,could you help me(can I use macro to resolve this problem).
TMP is a PL/SQL Variable. If you want to make an assignment to it or use it in a PL/SQL command you do not need to use the &. & is only used as a variable in a SQL command. for example if I have a sql file that connects as SYSTEM and does some stuff I could do the following.
-- do some stuff
You would run this inside a .sql file and when the connect statement comes up it will prompt you for the password and alias.
Click Here to Expand Forum to Full Width