Modify the sql to generate the mailx commands in the spool file and then execute the commands in the shell script:
Modified SQL Code: Modified Script (Not Tested):
You can customize the mail subject line in the sql as per you requirement... Hope this helps...
regards,
Arun.
Last edited by arunsoman80; 06-25-2009 at 03:08 PM..
Hi,
i would like to retrieve seql result and write it into unix text file like "result.txt"
In unix, normally, I type "sql" and get into sql,then type "select....." to run and get the result....then copy and paste into result.txt
any possible way to write a script to run it automatically?... (3 Replies)
Hi,
I have about 12 columns and 15 rows to be retrived from sybase isql command through unix. But when i output the sql into a file and see it, the formatting is going for a toss. can someone please suggest how can i get the result correctly in the output file ?
Thanks,
Sateesh (2 Replies)
Hi guys,
Is there a way a script can run an SQL statement and dump the results into a variable which can then be used later in the script?
Thanks. (3 Replies)
Hi,
1st post...
Done a quick search for this so apologies if I've missed it.
Basically I want to output and and append several values generated by a csh script direct to an xls openoffice file, rather than send to txt file and then physically copy and paste to xls file.
Already I send... (4 Replies)
I have SQL giving me output of disabled ids in the system every day.
I can send on email for this disabled user list.
But I want to send one email for every disabled user or for every row.
thank you for your help.
Kyle (2 Replies)
I am currently returning an sql result with a number value that I want to format as an amount. The sql runs smoothly on its own, but when run inside my ksh script an error is encountered:
ERROR at line 3:
ORA-01481: invalid number format model
My sql is --
select distinct
... (6 Replies)
Hi
im trying to assign the result of the db2 command to a variable inside a shell script...
: tab_cnt=`db2 "select count(*) from syscat.tables where tabname = 'ABC' and tabschema = 'MATT01'" |head -4|tail +4|cut -c 11`
: echo $tab_cnt
when i echo im getting a blank value.. im expecting... (1 Reply)
This is my first time writing a script and Im having some trouble,
Im trying to use the top command to monitor processes and the amount of CPU usage they require, my aim is to get an email if a process takes over a certain percentage of CPU usage
I tried grep
Obviosly that hasnt worked,
Any... (8 Replies)
How to Get SQL query result to file in putty?
I have one SQL query and I want that query output to be redirected to the file.
uname -a
SunOS XXX 5.8 Generic_117350-58 sun4u sparc SUNW,Sun-Fire-480R
Please suggest. (7 Replies)
hi ,
i have written below piece of code to meet the requirement but i am stuck in the logic here.
the requirement are:
1) to send the sql out put to email body with proper formatting.
2) if count_matching = Yes then mail should triggered with the subject line ... (10 Replies)
Discussion started by: itzkashi
10 Replies
LEARN ABOUT PHP
cubrid_execute
CUBRID_EXECUTE(3) 1 CUBRID_EXECUTE(3)cubrid_execute - Execute a prepared SQL statementSYNOPSIS
resource cubrid_execute (resource $conn_identifier, string $sql, [int $option])
DESCRIPTION
bool cubrid_execute (resource $request_identifier, [int $option])
The cubrid_execute(3) function is used to execute the given SQL statement. It executes the query by using $conn_identifier and SQL, and
then returns the request identifier created. It is used for simple execution of query, where the parameter binding is not needed. In addi-
tion, the cubrid_execute(3) function is used to execute the prepared statement by means of cubrid_prepare(3) and cubrid_bind(3). At this
time, you need to specify arguments of $request_identifier and $option.
The $option is used to determine whether to get OID after query execution and whether to execute the query in synchronous or asynchronous
mode. CUBRID_INCLUDE_OID and CUBRID_ASYNC (or CUBRID_EXEC_QUERY_ALL if you want to execute multiple SQL statements) can be specified by
using a bitwise OR operator. If not specified, neither of them isselected. If the flag CUBRID_EXEC_QUERY_ALL is set, a synchronous mode
(sync_mode) is used to retrieve query results, and in such cases the following rules are applied:
oThe return value is the result of the first query.
o If an error occurs in any query, the execution is processed as a failure.
o In a query composed of q1 q2 q3, if an error occurs in q2 after q1 succeeds the execution, the result of q1 remains valid. That
is, the previous successful query executions are not rolled back when an error occurs.
o If a query is executed successfully, the result of the second query can be obtained using cubrid_next_result(3).
If the first argument is $request_identifier to execute the cubrid_prepare(3) function, you can specify an option, CUBRID_ASYNC only.
PARAMETERS
o $conn_identifier
-Connection identifier.
o $sql
-SQL to be executed.
o $option
-Query execution option CUBRID_INCLUDE_OID, CUBRID_ASYNC, CUBRID_EXEC_QUERY_ALL.
o $request_identifier
-cubrid_prepare(3) identifier.
RETURN VALUES
Request identifier, when process is successful and first param is conn_identifier; TRUE, when process is successful and first argument is
request_identifier.
FALSE, when process is unsuccessful.
CHANGELOG
+--------+----------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+----------------------------------------+
| 8.4.0 | |
| | |
| | Add new option CUBRID_EXEC_QUERY_ALL. |
| | |
+--------+----------------------------------------+
EXAMPLES
Example #1
cubrid_execute(3) example
<?php
$conn = cubrid_connect("localhost", 33000, "demodb");
$result = cubrid_execute($conn, "SELECT code FROM event WHERE name='100m Butterfly' and gender='M'", CUBRID_ASYNC);
$row = cubrid_fetch_array($result, CUBRID_ASSOC);
$event_code = $row["code"];
cubrid_close_request($result);
$history_req = cubrid_prepare($conn, "SELECT * FROM history WHERE event_code=?");
cubrid_bind($history_req, 1, $event_code, "number");
cubrid_execute($history_req);
printf("%-20s %-9s %-10s %-5s
", "athlete", "host_year", "score", "unit");
while ($row = cubrid_fetch_array($history_req, CUBRID_ASSOC)) {
printf("%-20s %-9s %-10s %-5s
",
$row["athlete"], $row["host_year"], $row["score"], $row["unit"]);
}
cubrid_close_request($history_req);
cubrid_disconnect($conn);
?>
The above example will output:
athlete host_year score unit
Phelps Michael 2004 51.25 time
SEE ALSO cubrid_prepare(3), cubrid_bind(3), cubrid_next_result(3), cubrid_close_request(3), cubrid_commit(3), cubrid_rollback(3).
PHP Documentation Group CUBRID_EXECUTE(3)