Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Null handlings in Pro*C

RE: Null handlings in Pro*C

From: Srinivasan Subramanian kandallu <srinivasan.kandallu_at_wipro.com>
Date: Tue, 23 May 2000 15:28:46 +0530
Message-Id: <10506.106342@fatcity.com>


Hi Raman,

         It is as same as the way you do with indicator variables in Pro*c. Hope this program will clear your doubts.
Assume there is a table t3 with one NULL entry. SQL> desc t3

 Name                            Null?    Type
 ------------------------------- -------- ----
 A                                        NUMBER

insert into t3 values (NULL);
commit;

Pro*c Code starts from here:

#include<stdio.h>
EXEC SQL INCLUDE SQLCA;
EXEC SQL BEGIN DECLARE SECTION;
int i;
short ui = 0;
EXEC SQL END DECLARE SECTION;
main()
{
EXEC SQL WHENEVER SQLERROR do printf("Error =%s\n",sqlca.sqlerrm.sqlerrmc); i = iConnect();
EXEC SQL EXECUTE
begin
select a into :i:ui from t3;
end;
end-exec;
printf("ui = [%d]\n",ui);
printf("error code =[%d]\n",sqlca.sqlcode); }

Here is the Screen output:
ui = -1;
error code = 0

Regards,
Srini

-----Original Message-----
From: root_at_fatcity.com [mailto:root_at_fatcity.com]On Behalf Of raman.yagna_at_db.com
Sent: Tuesday, May 23, 2000 12:39 PM
To: Multiple recipients of list ORACLE-L Subject: RE: Null handlings in Pro*C

hi rick,

        Thanks for the answer . But my question was how to use indicator variables inside a plsql block inside a Pro*C program . Or is there any other way . Thanks once again.

Regards,
Raman

Please respond to ORACLE-L_at_fatcity.com

To: ORACLE-L_at_fatcity.com
cc:

In Pro*C you assign to indicator variables by FETCH cursor_name INTO
:variable_name:indicator_variable_name

Rick

> -----Original Message-----

> From:   raman.yagna_at_db.com [SMTP:raman.yagna_at_db.com]
> Sent:   Monday, May 22, 2000 5:34 AM
> To:     Multiple recipients of list ORACLE-L
> Subject:     Null handlings in Pro*C
>
> Hi gurus,
>       Sorry for posting this question again . Can anyone help me in this
> regard .
>
> Regards,
> Raman
>
>

> ---------------------- Forwarded by Raman Yagna on 22/05/2000 16:22
> ---------------------------
> > > To: ORACLE-L_at_fatcity.com > cc: > Subject: > > How to handle the indicator variables in a pl/sql block inside a Pro*C > program. If we are using a select into or Fetch into then along with the > host variable the indicator variable can be placed. But if the value is > getting assigned to the host variable using an assignment statement , then > how to put the indicator variable. > > Please take the following example how the indicator variable can be put > inside the PL/SQL block. > > main() > { > EXEC SQL BEGIN DECLARE SECTION; > > varchar salary[20]; > short ind_var; > > EXEC SQL END DECLARE SECTION; > > EXEC SQL EXECUTE > DECLARE > l_tab_sal varchar2(20); > BEGIN > > Here I call a pl/sql block with the paramters and out value as > l_tab_sal; > > if l_tab_sal is null this is giving 1405 error . I can handle by > specifying nvl but i want to handle thru indicator variables inside > plsql block . > > :salary := l_tab_sal; /* HOW TO ASSIGN INDICATOR VARIABLE HERE */ > > END; > END EXEC; > > salary[salary.len] = '\0'; > printf ("value is %s", salaray.arr); > } > > Raman > > > -- > Author: > INET: raman.yagna_at_db.com > > Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 > San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message > to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in > the message BODY, include a line containing: UNSUB ORACLE-L > (or the name of mailing list you want to be removed from). You may > also send the HELP command for other information (like subscribing). -- Author: Cale, Rick T (Richard)

  INET: RICHARD.T.CALE_at_saic.com
Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
--
Author:
  INET: raman.yagna_at_db.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
Received on Tue May 23 2000 - 04:58:46 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US