Sponsored Content
Full Discussion: Executing SQL's in parallel
Top Forums UNIX for Beginners Questions & Answers Executing SQL's in parallel Post 303041094 by member2014 on Thursday 14th of November 2019 11:49:06 AM
Old 11-14-2019
I am trying to design this and looking for recommendations. As of now i'm thinking to write a script which will take the id as input and execute it. And a wrapper around it to call the script and pass the parameters.

When i try to get a list of ids' into a variable it does not work. Any suggestions on how we can get the list of values into a variable/array in unix which can be used later to use in a loop?

Code:
dual_value=`sqlplus -s ${DB_CONN_STR} <<-EOF
       	set serveroutput on
	set heading off
       	set feedback off
       	WHENEVER SQLERROR EXIT SQL.SQLCODE;
        
	select id from list_of_sql where status = 'P';
  
	EOF`

 

10 More Discussions You Might Find Interesting

1. Programming

Executing pl/sql using sqlplus on unix

Hi to all, I have a endday.sh file. And I execute this like "sh endday.sh" from command prompt. In endday.sh file it writes: sqlplus temp/temp@data @run.sql& echo $!>>pid.txt However my aim is not to put the pid into pid.txt but I need to insert the pid into an oracle table using sqlplus.... (1 Reply)
Discussion started by: maverick1234
1 Replies

2. Shell Programming and Scripting

Executing pl/sql using sqlplus on unix

Hi to all, I have a endday.sh file. And I execute this like "sh endday.sh" from command prompt. In endday.sh file it writes: sqlplus temp/temp@data @run.sql& echo $!>>pid.txt However my aim is not to put the pid into pid.txt but I need to insert the pid into an oracle table using sqlplus.... (1 Reply)
Discussion started by: maverick1234
1 Replies

3. Shell Programming and Scripting

need some help in executing sql

i am stuck with a problem ... i have a shell script that gets the file name as input and performs the following operation... it runs through a for loop inside from which i connect to sqlplus and run a procedure that creates a number of tables .. there is no space in my server so we have made... (0 Replies)
Discussion started by: sais
0 Replies

4. Shell Programming and Scripting

Executing scripts in Parallel

Hi All, I have 3 shell scripts, Script1,Script2 and Script3. Now I want to run Script1 and Script2 in parallel and Script3 should depend on successful completion of both Script1 and Script2. Could you please suggest an approach of acheiving this... Thanks in advance (2 Replies)
Discussion started by: itsme_maverick
2 Replies

5. Shell Programming and Scripting

Help with executing parallel sessions for same shell script with different but fixed parameters

Hi Experts, There is a shell script that accepts positional parameter between 1-25 to execute case statement of script depending upon the parameter passed. Now I need to run all the 25 sessions parallely. In each option of case statement it is connecting with sqlplus and executing a select... (11 Replies)
Discussion started by: Opamps123
11 Replies

6. UNIX for Advanced & Expert Users

Call parallel sql scripts from shell and return status when both sql are done

Hi Experts: I have a shell script that's kicked off by cron. Inside this shell script, I need to kick off two or more oracle sql scripts to process different groups of tables. And when both sql scripts are done, I will continue in the shell script to do other things like checking processing... (3 Replies)
Discussion started by: huasheng8
3 Replies

7. Shell Programming and Scripting

Executing two commands in parallel

Hi, I am stuck into a situation where i want to execute a command in my shell script well along with a previous command in order to achieve something but i am not figuring out a way. here is a snippet: service management restart rm -rf lock.file in the above, if you see, i am trying to... (5 Replies)
Discussion started by: sunrexstar
5 Replies

8. Shell Programming and Scripting

Parallel SQL sessions in shell script

i have 3 sqls , sql 1 and sql 2 shuld run in parallel , but sql 3 should run after completion f sql1 nd sql2, my code is as below, please suggest the changes sqlplus username1/password1@DB1 @sql >> log1 & sqlplus username2/password2@DB2 @sql2 >> log1 & how can i execute the... (7 Replies)
Discussion started by: only4satish
7 Replies

9. Shell Programming and Scripting

Executing Multiple Queries in parallel in Shell

I have n number of SQL queries needs to executed in Shell. Result of this query need to assign in a variable. Once all the queries are executed script needs to exit. Sample Query: SQL 1: Select Count(*) from TABLE GROUP BY COL1,COL2 SQL 2: Select Count(*) from TABLE GROUP BY COL1,COL2 ... (2 Replies)
Discussion started by: Niranjancse
2 Replies

10. Shell Programming and Scripting

Parallel processing of SQL through Shell

Hi Friends, I am trying to write a shell which will invoke 3 CTAS (ORACLE create table XXX as select * from YYYY). The approximate time for one CTAS is around 25 mins. So i want to run the CTAS script parallely. My pseudocode is as below. Main script nohup sh CTAS1.sh &... (3 Replies)
Discussion started by: Showdown
3 Replies
PDO.QUERY(3)								 1							      PDO.QUERY(3)

PDO
::query - Executes an SQL statement, returning a result set as a PDOStatement object SYNOPSIS
public PDOStatement PDO::query (string $statement) DESCRIPTION
PDOStatement PDO::query (string $statement, int $PDO::FETCH_COLUMN, int $colno) PDOStatement PDO::query (string $statement, int $PDO::FETCH_CLASS, string $classname, array $ctorargs) PDOStatement PDO::query (string $statement, int $PDO::FETCH_INTO, object $object) PDO.query(3) executes an SQL statement in a single function call, returning the result set (if any) returned by the statement as a PDOStatement object. For a query that you need to issue multiple times, you will realize better performance if you prepare a PDOStatement object using PDO.pre- pare(3) and issue the statement with multiple calls to PDOStatement.execute(3). If you do not fetch all of the data in a result set before issuing your next call to PDO.query(3), your call may fail. Call PDOState- ment.closeCursor(3) to release the database resources associated with the PDOStatement object before issuing your next call to PDO.query(3). Note Although this function is only documented as having a single parameter, you may pass additional arguments to this function. They will be treated as though you called PDOStatement.setFetchMode(3) on the resultant statement object. PARAMETERS
o $statement - The SQL statement to prepare and execute. Data inside the query should be properly escaped. RETURN VALUES
PDO.query(3) returns a PDOStatement object, or FALSE on failure. EXAMPLES
Example #1 Demonstrate PDO::query A nice feature of PDO.query(3) is that it enables you to iterate over the rowset returned by a successfully executed SELECT state- ment. <?php function getFruit($conn) { $sql = 'SELECT name, color, calories FROM fruit ORDER BY name'; foreach ($conn->query($sql) as $row) { print $row['name'] . " "; print $row['color'] . " "; print $row['calories'] . " "; } } ?> The above example will output: apple red 150 banana yellow 250 kiwi brown 75 lemon yellow 25 orange orange 300 pear green 150 watermelon pink 90 SEE ALSO
PDO.exec(3), PDO.prepare(3), PDOStatement.execute(3). PHP Documentation Group PDO.QUERY(3)
All times are GMT -4. The time now is 04:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy