Extracting Table names from a Select Stament


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Extracting Table names from a Select Stament
# 1  
Old 02-29-2008
Extracting Table names from a Select Stament

Hi,

I am working on a code to extract the table names out of a select statement. Is there anybody who has worked on something similar? May be you could provide me with the regular expression for the same.

Regards.

Silas
# 2  
Old 02-29-2008
hey hi

i didint got urs question correctly....! man

u want sql statement

fine then u can give it as

select * from all_tabs_colums where table_name ="name of the table";

sum thing like


varible name =`sqlplus -s "id"/"password" << END

set serveroutput on
select * from all_tabs_colums where table_name ="name of the table";

end'
# 3  
Old 02-29-2008
Hi

Quote:
Originally Posted by kulbir
i didint got urs question correctly....! man

u want sql statement

fine then u can give it as

select * from all_tabs_colums where table_name ="name of the table";

sum thing like


varible name =`sqlplus -s "id"/"password" << END

set serveroutput on
select * from all_tabs_colums where table_name ="name of the table";

end'
Sorry for nto being very clear.

The script should:

Given a sql statement,

For Eg. select * from table1 t1, table2 t2 where .....

extract the table names from this sql statement. i. e we should be able to extract table1 and table2.

Is that fine?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Query to SELECT only Column Names that Contain a Specific String?

Hey Guys, I'm using SQuirreL SQL v3.5 GUI to fetch some data that I need for something I'm working on. I'm also using the IBM Informix Driver (*Version 3.5) to connect to the Database. What I want to do, if it's even possible, is to show all COLUMNS if they contain the word "Email". So in... (2 Replies)
Discussion started by: mrm5102
2 Replies

2. Shell Programming and Scripting

Select table name from file

i have a file tabel.out which contain table name in this format. xyz abc qwe Plz help me writing one script which actually takes tablename from file table.out file one by one and then select count (*) from $tablename limit 10; and print error in output file if any tabel is not... (4 Replies)
Discussion started by: netdbaind
4 Replies

3. Shell Programming and Scripting

mysql how to select a specific row from a table

i have a table records ------------ id | user | time | event 91 admin | 12:00 | hi 92 admin | 11:00 | hi 93 admin | 12:00 | bye 94 admin | 13:00 | bye 95 root | 12:00 | hi 96 root | 12:30 | hi 97 root | 12:56 | hi how could i only select and display only the user and event from... (6 Replies)
Discussion started by: kpddong
6 Replies

4. Shell Programming and Scripting

select values from db1 table and insert into table of DB2

Hi I am having three oracle databases running in three different machine. their ip address is different. from one of the DB am able to access both the databases.(means am able to select values and insert values in to tables individually.) I need to fetch some data from DB1 table(say DB1 ip is... (2 Replies)
Discussion started by: aemunathan
2 Replies

5. Shell Programming and Scripting

How to select only those file names whose name contains only numerals.

Hi Guru's, Before writing to this forum I have searched extensively on this forum about my problem. I have to write a shell script which takes out only those file names from the given directory which contains only numbers. For example, In the given directory these files are present: ... (5 Replies)
Discussion started by: spranm
5 Replies

6. UNIX for Advanced & Expert Users

How to select only those file names whose name contains only numbers

Hi Guru's, Before writing to this forum I have searched extensively on this forum about my problem. I have to write a shell script which takes out only those file names from the given directory which contains only numbers. For example, In the given directory these files are present: ... (4 Replies)
Discussion started by: spranm
4 Replies

7. UNIX for Dummies Questions & Answers

How to select only those file names whose name contains only numbers.

Hi Guru's, Before writing to this forum I have searched extensively on this forum about my problem. I have to write a shell script which takes out only those file names from the given directory which contains only numbers. For example, In the given directory these files are present: ... (0 Replies)
Discussion started by: spranm
0 Replies

8. UNIX for Dummies Questions & Answers

Extracting all table names from a given server

Using ksh and sqlplus... does anybody have an idea of how we can possibly extract all table names from server :confused:? thanks in advance. (6 Replies)
Discussion started by: fmina
6 Replies

9. UNIX for Dummies Questions & Answers

Extracting column names from a table.. SQL with UNIX

:rolleyes: hi there everybody, i need help,... thanks anyway! i am working on a very huge table with the name table1. the problem is that i know only one field name in this table..., working with a ksh environment i don't know how to view the table to check out the field names :confused:. ... (4 Replies)
Discussion started by: fmina
4 Replies

10. Shell Programming and Scripting

Extracting select queries from script

Hi, I have a script in which a lot of sql queries are embedded ie,"Select .....;".My purpose is to document all the dml statements in the script along with the line number. I am thinking of writing a perlscript or by using awk/sed scripts for extracting all the 'select' statements/queries... (3 Replies)
Discussion started by: DILEEP410
3 Replies
Login or Register to Ask a Question