Unable to run a SQL statement

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
kiran kumar
Participant
Posts: 25
Joined: Wed May 02, 2007 1:07 am

Unable to run a SQL statement

Post by kiran kumar »

Hi,

I am calling a SQL query which has a FUNCTION (DERIVE) in the Oralce OCI stage (Custom SQL statement). The query is running fine from command line.

-- SELECT TABLE_ID, CC_ID, CC_TEST.DERIVE(TN||T_CODE) AS CC_ID_NEW FROM VEN_DETAILS WHERE REGION IS NOT NULL AND (NVL(CC_ID,0) <> NVL(DERIVE(TN||T_CODE),0))

Can you please guide me in this.


Regards,
Kiran Kumar
chandra.shekhar@tcs.com
Premium Member
Premium Member
Posts: 353
Joined: Mon Jan 17, 2011 5:03 am
Location: Mumbai, India

Post by chandra.shekhar@tcs.com »

Whats the error ?
Thanx and Regards,
ETL User
BI-RMA
Premium Member
Premium Member
Posts: 463
Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg

Post by BI-RMA »

Hi Kumar,

first of all: is the beginning of your line ("--") present in your job?

"--" identifies the content of the rest of the line as comment. So what you posted here is not an SQL-Statement but a commented out SQL-Statement.

It is impossible to guide you concerning the usage of the function DERIVE, since You can see by the name that it is a user defined function contained in package CC_TEST, which is unknown to me.
Still, at second guess, I would expect a function to accept one or more parameters separated by comma, but I would expect it does not allow use of concatenation marks. And "NVL(DERIVE(TN||T_CODE),0))" could be an inconsistency of datatypes (string replaced by number on NULL-input).

But since you do not say anything about the type of error-message you get, this is just educated guessing.
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
kiran kumar
Participant
Posts: 25
Joined: Wed May 02, 2007 1:07 am

Post by kiran kumar »

Hi,

Thanks for the response.

The query is not commented out. I just gave two hyphens before the query.

SELECT TABLE_ID, CC_ID, CC_TEST.DERIVE(TN||T_CODE) AS CC_ID_NEW FROM VEN_DETAILS WHERE REGION IS NOT NULL AND (NVL(CC_ID,0) <> NVL(DERIVE(TN||T_CODE),0))

The error was "ORA-00904 string: invalid identifier"

Regards,
Kiran Kumar
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

To confirm that you are in the right database in the right environment, what happens if you write a test job with the SQL "SELECT TABLE_ID FROM VEN_DETAILS "?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's not a DataStage error - it's a database error (invalid identifier).

Try qualifying the table name with a schema/owner name. Check, too, that every one of the columns you've named belongs in that table and that the alias name you've used doesn't.

Is it legal to use expressions in the WHERE clause? Perhaps you should use the alias from the SELECT clause in the WHERE clause.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply