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:RE: Null handlings in Pro*C

Re:RE: Null handlings in Pro*C

From: <dgoulet_at_vicr.com>
Date: Tue, 23 May 2000 09:13:34 -0400
Message-Id: <10506.106361@fatcity.com>


Raman,

    You do that the same way you would in a normal call. Let's see if I can dump an example off the top of my head:

EXEC SQL BEGIN DECLARE SECTION;
    VARCHAR name[40];
      short int i_name = 0;
EXEC SQL END DECLARE SECTION; EXEC SQL EXECUTE

     DECLARE
       CURSOR EMPL_NAMES IS
       SELECT NAME FROM EMP;
     BEGIN
       OPEN EMPL_NAMES
       FETCH EMPL_NAMES INTO :name:i_name;
       IF(:i_name = 0) THEN
          <something>
       ELSE <something else>
       END IF;
       CLOSE EMPL_NAMES;
     END;

END-EXEC;
____________________Reply Separator____________________
Subject: RE: Null handlings in Pro*C
Author: raman.yagna_at_db.com
Date: 5/22/00 11:08 PM

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 - 08:13:34 CDT

Original text of this message

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