Home » SQL & PL/SQL » SQL & PL/SQL » Can a variable be set as Default null which reference a not null column? (oracle9i)
Can a variable be set as Default null which reference a not null column? [message #343431] Wed, 27 August 2008 05:07 Go to next message
Olivia
Messages: 519
Registered: June 2008
Senior Member
Create or replace procedure (
in_emp_id varchar2 DEFAULT NULL,
..
)
as
Begin 

Insert into emp(empid,..) values(in_emp_id,...)
..
end;


Is the declaration section correct( it is set as default Null) for a database column empid which is is not null.I think it
should not be. Need to clear my doubt here as in most of the procedures I can see the variable in declarative section is set as default NULL where the column it references is not null.



Regards,
Oli

[Updated on: Wed, 27 August 2008 05:07]

Report message to a moderator

Re: Can a variable be set as Default null which reference a not null column? [message #343436 is a reply to message #343431] Wed, 27 August 2008 05:15 Go to previous messageGo to next message
rahulsql
Messages: 18
Registered: August 2008
Junior Member
study the oracle documentation there you can find the details about it
Re: Can a variable be set as Default null which reference a not null column? [message #343438 is a reply to message #343436] Wed, 27 August 2008 05:23 Go to previous messageGo to next message
Olivia
Messages: 519
Registered: June 2008
Senior Member
rahulsql wrote on Wed, 27 August 2008 05:15
study the oracle documentation there you can find the details about it


Need to clear my doubt here as in most of the procedures I can see the variable in declarative section is set as default NULL where the column it references is not null.
Re: Can a variable be set as Default null which reference a not null column? [message #343443 is a reply to message #343431] Wed, 27 August 2008 05:31 Go to previous messageGo to next message
Michel Cadot
Messages: 64109
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This is possible, no problem.

Regards
Michel
Re: Can a variable be set as Default null which reference a not null column? [message #343448 is a reply to message #343438] Wed, 27 August 2008 05:34 Go to previous messageGo to next message
dwarak.k
Messages: 61
Registered: June 2008
Location: Hyderabad
Member
Since the procedures and package.procedures can be reused at many places,the requirement might differ.Always passing empid might not be mandatory
Probably in a call where the update is going to be made on a table depending on the deptno,passing empid might not be possible.
In those cases these NULL initialization will be necessary.

If insert/update are made only through empid and no other functionality is involved in the procedure,Then it has to be made a mandatory argument

Re: Can a variable be set as Default null which reference a not null column? [message #343452 is a reply to message #343448] Wed, 27 August 2008 05:41 Go to previous message
Olivia
Messages: 519
Registered: June 2008
Senior Member
Thanks for the reply.


[Updated on: Wed, 27 August 2008 06:08]

Report message to a moderator

Previous Topic: how to fined total hour between a date
Next Topic: Accessing Image
Goto Forum:
  


Current Time: Mon Dec 05 09:12:06 CST 2016

Total time taken to generate the page: 0.14400 seconds