Home » Infrastructure » Linux » command to execute only required tables
command to execute only required tables [message #278611] Mon, 05 November 2007 02:49 Go to next message
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 #278618 is a reply to message #278611] Mon, 05 November 2007 03:08 Go to previous messageGo to next message
Michel Cadot
Messages: 58954
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Comment the unwanted statements.

Regards
Michel
Re: command to execute only required tables [message #278619 is a reply to message #278611] Mon, 05 November 2007 03:11 Go to previous messageGo to next message
varu123
Messages: 754
Registered: October 2007
Senior Member
Its a vi editor.
/**/ or #### ?
Re: command to execute only required tables [message #278622 is a reply to message #278619] Mon, 05 November 2007 03:14 Go to previous messageGo to next message
Michel Cadot
Messages: 58954
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Comment is /* */ or -- but not # in SQL.

Regards
Michel
Re: command to execute only required tables [message #278648 is a reply to message #278611] Mon, 05 November 2007 05:01 Go to previous messageGo to next message
varu123
Messages: 754
Registered: October 2007
Senior Member
Ok that is one way. But do we have any command that could select and execute the desired tables among severals.
Re: command to execute only required tables [message #278658 is a reply to message #278648] Mon, 05 November 2007 05:24 Go to previous messageGo to next message
Michel Cadot
Messages: 58954
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
How do you want to select?

Regards
Michel
Re: command to execute only required tables [message #278678 is a reply to message #278611] Mon, 05 November 2007 06:44 Go to previous messageGo to next message
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 #278708 is a reply to message #278678] Mon, 05 November 2007 07:48 Go to previous messageGo to next message
Michel Cadot
Messages: 58954
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
@/tab.sql is not a Linux command.

Regards
Michel
Re: command to execute only required tables [message #278740 is a reply to message #278611] Mon, 05 November 2007 09:15 Go to previous messageGo to next message
varu123
Messages: 754
Registered: October 2007
Senior Member
Shocked This is bad.
Ok if not at os level but in sql level.
There are so many tables,i can't comment all of them.

In windows i can copy and paste,how can i achieve the same functionality through the command.

Thanks
Re: command to execute only required tables [message #278741 is a reply to message #278740] Mon, 05 November 2007 09:21 Go to previous messageGo to next message
ThomasG
Messages: 3099
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
In Linux you can also copy and paste. Very Happy
Re: command to execute only required tables [message #278746 is a reply to message #278611] Mon, 05 November 2007 09:30 Go to previous messageGo to next message
varu123
Messages: 754
Registered: October 2007
Senior Member
you seem to be very happy with that knowledge.
Re: command to execute only required tables [message #278749 is a reply to message #278611] Mon, 05 November 2007 09:34 Go to previous messageGo to next message
BlackSwan
Messages: 22725
Registered: January 2009
Senior Member
>I want to execute only the desired create table statemnets.
How does anyone but you know which are the "desired" tables?
Re: command to execute only required tables [message #278753 is a reply to message #278611] Mon, 05 November 2007 09:44 Go to previous messageGo to next message
varu123
Messages: 754
Registered: October 2007
Senior Member
How would this knowledge help you in my question?
Re: command to execute only required tables [message #278754 is a reply to message #278753] Mon, 05 November 2007 09:57 Go to previous messageGo to next message
ThomasG
Messages: 3099
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.
Re: command to execute only required tables [message #278756 is a reply to message #278753] Mon, 05 November 2007 10:21 Go to previous messageGo to next message
Michel Cadot
Messages: 58954
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
If you can't explain us which tables are the good among the list, how could tell to the machine which are the good ones?

Regards
Michel
Re: command to execute only required tables [message #278757 is a reply to message #278611] Mon, 05 November 2007 10:28 Go to previous messageGo to next message
varu123
Messages: 754
Registered: October 2007
Senior Member

Why ThomasG's reply was ignored?

Re: command to execute only required tables [message #278760 is a reply to message #278757] Mon, 05 November 2007 10:35 Go to previous message
ThomasG
Messages: 3099
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Quote:

Why ThomasG's reply was ignored?


That's a question only you can answer, varu123. Why did you ignore my reply? ./fa/917/0/
Previous Topic: oracle database installation error
Next Topic: installation oracle 9 on RHEL4
Goto Forum:
  


Current Time: Tue Sep 02 00:38:54 CDT 2014

Total time taken to generate the page: 0.10033 seconds