Home » Infrastructure » Unix » Creating a report by running an SQL script from shell script
Creating a report by running an SQL script from shell script [message #296120] Thu, 24 January 2008 13:05 Go to next message
scriptinghelp
Messages: 2
Registered: January 2008
Junior Member
I need to write a shell script which does the following:

script shld be in such a way that I just need to pass a parameter and it shld generate the report by running a sql script and store it in a directory and email this report in every 30mins .this shell script should pass a parameter (by calling a function) into a sql script and generate a report and I want the name of the report in a specific format.

can someone please pass on the script if anyone has it or let me know how to do this?

any help is appreciated!!

[MERGED by LF]

[Updated on: Thu, 24 January 2008 15:22] by Moderator

Report message to a moderator

is this a valid statement? [message #296126 is a reply to message #296120] Thu, 24 January 2008 14:19 Go to previous messageGo to next message
scriptinghelp
Messages: 2
Registered: January 2008
Junior Member
I am trying to run mysql from my shell script by passign a parameter.the sql(script.sql) is in directory $mydir and the parameter is $date and trying to run it this way:

un="username"
pd="PASSWORD "
dbname="dbname"


result = `mysql($un,$pd,$dbname,$mydir,"script.sql",$date)`

I am trying to store the date in result.is this valid statement???

Please advise???????
thanks so much!!!!!
Re: is this a valid statement? [message #296131 is a reply to message #296126] Thu, 24 January 2008 15:20 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Speaking of 'mysql': are you talking about MySQL, the world's most popular open source database? If so, well, this is Oracle forum and you've asked a question in its UNIX forum which deals with Oracle-related problems while running an Oracle database on UNIX operating systems. In that case, please, ask for help on one of MySQL forums.

If, on the other hand, 'mysql' represents something related to Oracle, I hope you'll get the answer (I'm sorry, but I don't use UNIX and can't help you).
Re: is this a valid statement? [message #299611 is a reply to message #296131] Tue, 12 February 2008 12:17 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
sqlplus scott/tiger @myscript 123 | mailx -s "report" you@xyz.com 


myscript.sql
------------
select '&1' from dual;
Previous Topic: command
Next Topic: REFORMATING FILE
Goto Forum:
  


Current Time: Fri Mar 29 06:07:30 CDT 2024