[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference orarep::nomahs::sql

Title:SQL notes
Moderator:NOVA::SMITHI
Created:Wed Aug 27 1986
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3895
Total number of notes:17726

3886.0. "Indicator parameter in stored routines" by chsr38.ch.oracle.com::RROHR (Cajun? Zeydeco? Both!) Wed May 07 1997 06:17

    I am confused about the documentation on indicator parameters in stored
    routines:
    
    Page 13-7 of the SQL Progamming Guide states:
    
    "Stored procedures (or functions) support null values. As a result you
    *CANNOT* use indicator parameters with stored procedure(function)
    parameters."
    
    It continues: ... you must be sure to declare in the nonstored
    procedure that calls the stored procedure, an indicator parameter to
    ensure that you can process the NULL value...
    
    Page 13-12 says (under callout 1):
    
    Because parameters in stored procedures allow Null values, each main
    parameter *SHOULD HAVE* a corresponding indicator parameter.
    
    *CANNOT* have or *SHOULD HAVE*?
    
    Thanks,
    Regina
    
    
    
T.RTitleUserPersonal
Name
DateLines
3886.1NOVA::SMITHIDon't understate or underestimate Rdb!Wed May 07 1997 11:0346
Sounds right to me...

    "Stored procedures (or functions) support null values. As a result you
    *CANNOT* use indicator parameters with stored procedure(function)
    parameters."

	procedure P1 (in :a integer);
	begin
	if :a is null then ...
	end;

	Here :A as a parameter has NULL semantics.  No indicator is required
	nor can it be used.
    
    It continues: ... you must be sure to declare in the nonstored
    procedure that calls the stored procedure, an indicator parameter to
    ensure that you can process the NULL value...

	SQLMOD

	procedure DO_P1 (:a integer, :a_ind integer);
	    call P1 (:a indicator :a_ind);

	SQLPRE
	var
	   a, a_ind: integer;
	...
	exec sql
	    call P1 (:a indicator :a_ind);

	Here the call must provide the null indicator because neither SQLMOD
	nor SQLPRE support parameters or host variables with NULL semantics.
	(actually the 3GL's don't support it)

    Page 13-12 says (under callout 1):
    
    Because parameters in stored procedures allow Null values, each main
    parameter *SHOULD HAVE* a corresponding indicator parameter.
    
    *CANNOT* have or *SHOULD HAVE*?
    
	See the previous example.  If you leave off the INDICATOR clause
	then you can not pass IN a NULL value, and you may get an error
	if you ever pass back OUT a NULL value from a STORED PROCEDURE.

Ian
3886.2SuggestionOOTOOL::HIGGSSQL is a camel in disguiseWed May 07 1997 11:3511
If examples such as these were in the documentation, it would
help users to understand the (sometimes confusing) descriptive
text.   That would also help reduce the number of such
questions in this conference and other forums.

Any chance we can ask the good doc folks to insert them in the
right places?

Bryan