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

Home -> Community -> Usenet -> c.d.o.server -> Re: Dynamic SQL in PRO-C (type 3), problem with NULL

Re: Dynamic SQL in PRO-C (type 3), problem with NULL

From: John Gasch <jgasch_at_erols.com>
Date: 2000/03/31
Message-ID: <38E55B95.B4A03A7F@erols.com>#1/1

This is kludgy but I believe this should work. Try adding an outer-join of DUAL.

A simple query such as:

   SELECT myTable.aField

      FROM myTable
      WHERE ...
      ;

Change to:

   SELECT NVL(myTable.aField, valueIfNull)

      FROM myTable, Dual
      WHERE ...
      AND   myTable.aField(+) IS NOT NULL;

If your query involves a join, wrap it as follows:

   SELECT whatever

      FROM ( SELECT NVL(aTable.aField, valueIfNull) anAlias
                FROM aTable, bTable
                WHERE ...
           ) myQuery,
           Dual
      WHERE myQuery.anAlias(+) IS NOT NULL
      ;
 

Another technique would be to wrap your query into a PL/SQL block with an exception handler to catch the NO_DATA_FOUND condition.

Good luck.

John Gasch

"Riccardo D.S." wrote:
>
> I use e dynamic SQL statment (pro c - type 3 ) to estract
> the value of single column and put it in the host-variable.
> When the return of query is Null the SQL statment go in error .
> Is it possible when this occur continue the process?
> Now use the NVL function to return a particulat string
> or number when the value is NULL. I prefer ignore the select
> when tha value is Null and continue to other select.
>
> Thanks,
> Sorry for my english...
>
> I'm italian
>
> Dott. Riccardo Di Stefano
> Alenia Marconi System s.p.a.
> Rome - Italy
  Received on Fri Mar 31 2000 - 00:00:00 CST

Original text of this message

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