command to execute only required tables [message #278611] |
Mon, 05 November 2007 02:49 |
varu123
Messages: 754 Registered: October 2007
|
Senior Member |
|
|
I have a sql file. I have various create table statements in it.
I want to execute only the desired create table statemnets.
How can i do so?
@/tab.sql would execute all the statemnets.
|
|
|
|
|
|
|
|
Re: command to execute only required tables [message #278678 is a reply to message #278611] |
Mon, 05 November 2007 06:44 |
varu123
Messages: 754 Registered: October 2007
|
Senior Member |
|
|
Lets suppose i have a tab.sql file that has create table statements.
I know the names of the table in tab.sql.
I want to select the tables by there names.For example
tab.sql file has 5 create table statements table a,b,c,d,e
I want to execute the create table statement of a and d.
How could i do it in linux.
@/tab.sql would execute all the statements
|
|
|
|
|
|
|
|
|
Re: command to execute only required tables [message #278754 is a reply to message #278753] |
Mon, 05 November 2007 09:57 |
ThomasG
Messages: 3212 Registered: April 2005 Location: Heilbronn, Germany
|
Senior Member |
|
|
Well, you have some options that could work:
1. FTP the file over to windows and it there.
2. If a GUI is installed on the Linux box edit it under the GUI where you can copy/paste in the text editor (kedit, kate, xedit, ....) like you do in windows
3. copy/paste within vi with the vi commands.
4. split the one tab.sql into single tab_tableX.sql files and execute only the ones you want.
5. Change the pure SQL into an pl/sql procedure which uses an command line parameter and a if-loops to select the tables.
6. Write some sort of shell script to execute the sql statements based on command line parameters. PERL might come in handy there.
1) or 4) could be accomplished fastest, I think.
But there is no easy one-command solution.
|
|
|
|
|
|