Max of a column from Oracle table

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Titto
Participant
Posts: 148
Joined: Tue Jun 21, 2005 7:49 am

Max of a column from Oracle table

Post 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
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Post your exact SQL please.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Titto
Participant
Posts: 148
Joined: Tue Jun 21, 2005 7:49 am

Post 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,
nivas
Participant
Posts: 117
Joined: Sun Mar 21, 2004 4:40 pm

Post 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,
Post Reply