dbTalk Databases Forums  

dynamic SQL query question

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss dynamic SQL query question in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
leileili@hotmail.com
 
Posts: n/a

Default dynamic SQL query question - 05-18-2005 , 05:11 PM






Hello,
I'm new in dynamic SQL query and I have a problem need help.

For example: I have a SQL query like this:

select hw.family,hw.id where hw.id="1234567";

and I have a txt file holding more than ten thousands id.
I need feed the ids from the file to the SQL query, inside
the "???", please let me know how can I do this?

then I put the SQL query in a file and run it from another .csh
file. Inside the .csh file, I have something like this:

mysql -u usrname dataname< /directory/sqlfile
Quote:
/directory/outputfile/id_???
how can I have the output files created with different names according
with the id inputs in the run time?

Thanks a lot.



Reply With Quote
  #2  
Old   
DA Morgan
 
Posts: n/a

Default Re: dynamic SQL query question - 05-18-2005 , 05:27 PM






leileili (AT) hotmail (DOT) com wrote:
Quote:
Hello,
I'm new in dynamic SQL query and I have a problem need help.

For example: I have a SQL query like this:

select hw.family,hw.id where hw.id="1234567";

and I have a txt file holding more than ten thousands id.
I need feed the ids from the file to the SQL query, inside
the "???", please let me know how can I do this?

then I put the SQL query in a file and run it from another .csh
file. Inside the .csh file, I have something like this:

mysql -u usrname dataname< /directory/sqlfile

/directory/outputfile/id_???


how can I have the output files created with different names according
with the id inputs in the run time?

Thanks a lot.
There is nothing dynamic about your SQL statement nor is there a need
to dynamic SQL.

What you need to do is create an external table to the text file.
Then just do an INSERT INTO ... SELECT FROM ....

You can find a demo of external table creation at:
http://www.psoug.org
click on Morgan's Library
click on External Tables
--
Daniel A. Morgan
http://www.psoug.org
damorgan@x.washington.edu
(replace x with u to respond)


Reply With Quote
  #3  
Old   
leileili@hotmail.com
 
Posts: n/a

Default Re: dynamic SQL query question - 05-18-2005 , 05:36 PM



oh, I'm sorry, I'm sending this to comp.database.ms-access,
hope that's a right place to get right answer.


Reply With Quote
  #4  
Old   
Mark C. Stock
 
Posts: n/a

Default Re: dynamic SQL query question - 05-18-2005 , 05:56 PM




<leileili (AT) hotmail (DOT) com> wrote

Quote:
oh, I'm sorry, I'm sending this to comp.database.ms-access,
hope that's a right place to get right answer.

ms-access is Microsoft Access

you want a MySQL group





Reply With Quote
  #5  
Old   
leileili@hotmail.com
 
Posts: n/a

Default Re: dynamic SQL query question - 05-18-2005 , 06:06 PM



can't find any MySQL group here.
Trying www.mysql.com now.
Thanks.


Reply With Quote
  #6  
Old   
Malcolm Dew-Jones
 
Posts: n/a

Default Re: dynamic SQL query question - 05-18-2005 , 06:25 PM



leileili (AT) hotmail (DOT) com wrote:

: mysql -u usrname dataname< /directory/sqlfile
: >/directory/outputfile/id_???

That is mysql. This is an Oracle group. A good answer for Oracle will
not help you in mysql.

Personally, I would use perl and DBI.



--

This space not for rent.

Reply With Quote
  #7  
Old   
leileili@hotmail.com
 
Posts: n/a

Default Re: dynamic SQL query question - 05-18-2005 , 07:06 PM



but I don't own the database.
Can I still do this?

Thanks.


Reply With Quote
  #8  
Old   
Jim Kennedy
 
Posts: n/a

Default Re: dynamic SQL query question - 05-18-2005 , 09:38 PM




<leileili (AT) hotmail (DOT) com> wrote

Quote:
can't find any MySQL group here.
Trying www.mysql.com now.
Thanks.

Maybe that tells you something about that database.
Jim




Reply With Quote
  #9  
Old   
Malcolm Dew-Jones
 
Posts: n/a

Default Re: dynamic SQL query question - 05-19-2005 , 01:05 AM



leileili (AT) hotmail (DOT) com wrote:
: can't find any MySQL group here.
: Trying www.mysql.com now.
: Thanks.


Quoted from another group, where someone is promoting the start up of a
new group called comp.databases.mysql

:There are two news groups devoted to MySQL. Unfortunately their
:names don't comply with the conventions used for other database
roducts.

:mailing.database.mysql
:mailing.database.mysql-win32


I've never read em, but try

mailing.database.mysql
OR mailing.database.mysql-win32


--

This space not for rent.

Reply With Quote
  #10  
Old   
leileili@hotmail.com
 
Posts: n/a

Default Re: dynamic SQL query question - 05-19-2005 , 11:55 AM



thank you, www.mysql.com forum doesn't have any reply.
I'm trying mailing.database.mysql now. Thanks for the
pointer.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.