Home » SQL & PL/SQL » SQL & PL/SQL » query to find tablename, bindvariable column names (10.2.0.4)
query to find tablename, bindvariable column names [message #618034] Mon, 07 July 2014 00:30 Go to next message
grpatwari
Messages: 288
Registered: June 2008
Location: Hyderabad
Senior Member
Hi,

I have to write query to find the schema tablename and respected bind variable column names in the query.I have to insert these details into one table. Please advice how to proceed on this.

For example: My query is as below.
SELECT OP.RXC_OPPORTUNITY_ID,
       OAH.ATTEMPT_STATUS,
       OAH.USER_CREDENTIALS,
       OAH.CREATED_DATE
  FROM OPPORTUNITY OP, OPPORTUNITY_ATTEMPT_HISTORY OAH
 WHERE OP.RXC_OPPORTUNITY_ID = OAH.RXC_OPPORTUNITY_ID
   AND OP.RXC_OPPORTUNITY_ID = :1
   AND (IS_INACTIVE IS NULL OR IS_INACTIVE = 'N')
   AND OP.ZONE = :2;

Need to find the table names:
1. OPPORTUNITY and bind variable column names: RXC_OPPORTUNITY_ID, ZONE.
2. OPPORTUNITY_ATTEMPT_HISTORY
Re: query to find tablename, bindvariable column names [message #618039 is a reply to message #618034] Mon, 07 July 2014 01:31 Go to previous messageGo to next message
Michel Cadot
Messages: 68643
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Parse your statements.

Re: query to find tablename, bindvariable column names [message #618041 is a reply to message #618039] Mon, 07 July 2014 01:57 Go to previous messageGo to next message
grpatwari
Messages: 288
Registered: June 2008
Location: Hyderabad
Senior Member
I am using the below link for parsing and inserting into the table.
http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_sql.htm#i997061

But i will pass the query dynamically instead of hard coding.Also my query is not simple query and it may complex query (contains nested loop, joins etc).

Please advice.
Re: query to find tablename, bindvariable column names [message #618044 is a reply to message #618041] Mon, 07 July 2014 02:40 Go to previous message
Michel Cadot
Messages: 68643
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

What I mean is you have to scan and analyze your statement if you want the output you gave for the statement you gave. AFAIK, there is no built-in procedure to do it.

In addition, are your column names always prefixed by the table name or alias? If not, you also have to find, from Oracle dictionary, which table a column name belongs to.

Previous Topic: First Character Encountered Capitalised and rest in lower
Next Topic: what plsqls of this output?
Goto Forum:
  


Current Time: Tue Apr 23 23:35:07 CDT 2024