Question:
Hi Experts,
I am having some different requirement here like, while selecting data from a table, for some column need to deafult some constant value for all lines if the actual value in the DB table has no value. There are some aggregate results like MAX( [DISTINCT] col ), MIN( [DISTINCT] col )...COUNT( * ) (or count(*)) , But there is nothing as such to fill constant value in query time it self while selecting data.
Do help me if any one come across such a like.
Ex:
Normal code we write:
SELECT carrid connid cityfrom cityto
FROM spfli
INTO CORRESPONDING FIELDS OF wa.
WRITE: / wa-carrid, wa-connid, wa-cityfrom, wa-cityto.
ENDSELECT.
Required code need to write:
SELECT NVL(e.carrid,1000) connid cityfrom cityto
FROM spfli
INTO CORRESPONDING FIELDS OF wa.
WRITE: / wa-carrid, wa-connid, wa-cityfrom, wa-cityto.
ENDSELECT.
Thanks in advance.
Mohan.
Answer:
You have to do the select, then process the internal table afterwards.
m@t
_________________
TULY The quality of answers is roughly proportional to the quality of the question.
The downside of being better than everyone else is that people tend to assume you're pretentious.
Answer:
That is one of the really irritating things about open SQL ie that you can't include literals in the field list of a select. And you can't use normal Oracle SQL things like NVL and DECODE either. And so you have to take two steps to do that simple thing you want to do rather than one step.
You can of course do it in one step if you use real SQL....
_________________
Using SAP R/3 version 4.7 BASIS 6.20 under SunOS on an Oracle 10.2.0.2.0 database