embedded sql with indicators in other DBs

Started by Michael Meskesabout 25 years ago3 messages
#1Michael Meskes
meskes@postgresql.org

What do other DBs do with their output variables if there is an embedded SQL
query resulting in a NULL return value? What I mean is:

exec sql select text into :txt:ind from ...

If text is NULL, ind will be set, but does txt change?

I was just told Informix blanks txt.

Michael
--
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

#2Zeugswetter Andreas SB
ZeugswetterA@wien.spardat.at
In reply to: Michael Meskes (#1)
AW: embedded sql with indicators in other DBs

What do other DBs do with their output variables if there is
an embedded SQL
query resulting in a NULL return value? What I mean is:

exec sql select text into :txt:ind from ...

If text is NULL, ind will be set, but does txt change?

I was just told Informix blanks txt.

No, it gives a null string.
In general Informix has a value that represents null that is
'distinct from all legal values in any given datatype'.

Andreas

#3Christof Petig
christof.petig@wtal.de
In reply to: Michael Meskes (#1)
Re: embedded sql with indicators in other DBs

Michael Meskes wrote:

What do other DBs do with their output variables if there is an embedded SQL
query resulting in a NULL return value? What I mean is:

exec sql select text into :txt:ind from ...

If text is NULL, ind will be set, but does txt change?

I was just told Informix blanks txt.

Adabas D does not touch txt.
So you might set txt to a reasonable value in case of NULL, or hold the value
in txt of a previous sql statement. On the other hand if you forget to
initialize txt, Informix protects you from yourself.

At least the standard (sql94-bindings-3 clause 7.1) does not mention to change
the value of the variable in null case. Looks like undefined.

I'm undecided. Not touching it looks more right to me but it might break
existing applications.

Christof