Gustavo,
This is puzzling. Here is my code, which I patterned from your code. The only difference is that I added commands (dbms...) to display output to my screen during execution. I saved the code to a file identically named to yours, "C:\qafileshare\FindCDs_TEST.sql":
Code:
set serveroutput on format wrap
Declare
dpart varchar(50);
name_hold mytable1.name%type;
begin
dpart:='&1';
if dpart is null then
Select Name into name_hold from mytable1 where rownum=1;
dbms_output.put_line(name_hold);
else
Select Sub_Name into name_hold from mytable2 where rownum=1;
dbms_output.put_line(name_hold);
end if;
end;
/
Following is my successful test of your code, using identical invocations except for username and password:
Code:
D:\> sqlplus test/test @c:\qafileshare\FindCDs_TEST.sql TESTING
SQL*Plus: Release 9.2.0.4.0 - Production on Mon Feb 7 15:10:52 2005
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
old 5: dpart:='&1';
new 5: dpart:='TESTING';
Name from MyTable2
PL/SQL procedure successfully completed.
SQL>
Plus, here is my invocation of your code with a NULL entry in place of "TESTING", to show the other logic for:
Code:
D:\> sqlplus test/test @c:\qafileshare\FindCDs_TEST.sql ''
SQL*Plus: Release 9.2.0.4.0 - Production on Mon Feb 7 15:22:51 2005
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
old 5: dpart:='&1';
new 5: dpart:='';
Name from MyTable1
PL/SQL procedure successfully completed.
SQL> exit
So, my invocations were successful...your invocation was not. How do our two invocation sets differ as far as you can tell?
![[santa] [santa] [santa]](/data/assets/smilies/santa.gif)
Mufasa
(aka Dave of Sandy, Utah, USA)
@ 22:25 (07Feb05) UTC (aka "GMT" and "Zulu"),
@ 15:25 (07Feb05) Mountain Time
Click here to
Donate to Tsunami Relief. 100% of your contributions here go to the victims...0% to administration.
They were
"The First-Responder" to the disaster, with relief deliveries arriving before Red Cross and U.S. aid.