Work with IF oracle

lio42

Member
I have create a simple procedure Oracle but the
condtion is never execute:

--------------------------------
create or replace procedure TestIF(my_string in varchar2) is
begin
if my_chaine='BOB' then
dbms_output.put_line(my_string);
else
dbms_output.put_line('NOT BOB');
end if;
end TESTIF;
--------------------------------------------
With PL/SQL Devolopper testing my process with
my_string='BOB'
begin
-- Call the procedure
test5(my_string => :my_string);
end;
--------------------
Why my test is aborded?Bug with IF? :( :(
 
create or replace procedure TestIF(my_string in varchar2) is
begin
if my_string='BOB' then
dbms_output.put_line(my_string);
else
dbms_output.put_line('NOT BOB');
end if;
end TESTIF;

try the above code, changed my_chaine with my_string in the if statement. my_chaine would be defined elsewhere?
 
Works fine for me. The debugger takes the expected path, and the dbms_output is correct too.

You mention that your test is aborted? What exactly does that mean? Do you get the wrong dbms_output?
 
my procedure is good on Oracle,
my problem is in PL/SQL devolpper debugger.
tool does not pass in the test when my variable is egal=' BOB '

if 'BOB' ='BOB' is never always carried out.
else is always carried out

My version PL/SQL d :confused: evelopper limited version?...
 
You wrote:
tool does not pass in the test when my variable is egal=' BOB '

Well, I get the same behavior as you when I write:
' BOB '
as the variable (with spaces)
Try
trim(my_string)='BOB'
 
I think what you should do is get rid of the bind variable in the test script, or set the bind variable through the variable section on the bottom. So it either:

Code:
declare
 lv_string='BOB'
begin
-- Call the procedure
  test5(my_string => lv_string);
end;
or it is

Code:
begin
-- Call the procedure
  test5(my_string => :my_string);
end;
and the set the variable in the variable section on the bottom of the screen.

Hope this helps,
Kindest regards,
Patrick
 
Back
Top