Page 1 of 1

Max of a column from Oracle table

Posted: Thu Apr 06, 2006 8:00 am
by Titto
Hi,

My requirement is to get the Max(col1) and use this value to increment by one for each input row and create a load file, subsequently this load file used to load the table. when i use the sql using MAX on a column in ODBC stage it is giving error "Fatal error not a valid Identifier MAx(col1)"

is there any other way to get the max number and use that number to process the data?


Thanks

Posted: Thu Apr 06, 2006 8:26 am
by kcbland
Post your exact SQL please.

Posted: Thu Apr 06, 2006 9:48 am
by Titto
I got it correct, and working fine

I used following SQL

Code: Select all

SELECT 1 as ID,  nvl(MAX(COL1),0)  AS MAXNBR FROM TABLE1
If are they any other way please let me know!

Thanks,

Posted: Thu Apr 06, 2006 11:06 am
by nivas
Hi
The following way better. Apply Max after Nvl
SELECT 1 AS ID, MAX(NVL(COL1,0)) AS MAXNBR FROM TABLE1
Titto wrote:I got it correct, and working fine

I used following SQL

Code: Select all

SELECT 1 as ID,  nvl(MAX(COL1),0)  AS MAXNBR FROM TABLE1
If are they any other way please let me know!

Thanks,