PL/SQL (MOSC)

MOSC Banner

PL/SQL block doesn't set default values when passing null parameters to procedures

edited Jun 21, 2010 4:09AM in PL/SQL (MOSC) 8 commentsAnswered
create table ANU_TEST1

(

  SOURCE1 INTEGER default 1 not null,

  SOURCE2 INTEGER default 0 not null,

  SOURCE3 INTEGER default -1 not null

)

 

 

 

Create or replace procedure anu_test(

 a integer default 1,

 b integer default 0,

 c integer default -1)

 as

Begin

 

INSERT INTO anu_test1 values(a,b,c);

end;

when passing no values to procedure, it should insert a row with 1,0 and -1 to table anu_test1 but it's giving error saying can't insert null. I debug the procedure and found that a,b and c comes with as null value from procedure.

Please let me know where is wrong happening?

Thanks, 

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center