Using unix array in sql


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Using unix array in sql
# 8  
Old 06-26-2012
The code in post #1 should run in a recent ksh93, but since the the shebang is shifted one character to the right, it will just be treated as a comment and not be used anyway.
# 9  
Old 06-26-2012
I noticed that too but the first line of the desired output example also was shifted over by a space so I figured it was a copy/paste formatting issue.
# 10  
Old 06-26-2012
Thank you very much gary_w for this . i was breaking my head for this script.....thanks a lot.....
# 11  
Old 06-26-2012
You bet. FYI - I just realized there is no logging of the commit result. You would want to check that with another loop to read the output of the commit and report if it is not successful. Perhaps put the reading of the output loop in a function? I'll leave that as an exercise. :-)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem in passing IFS array to SQL Query

Hi, I have created a shell script that reads line from text file and insert into DB table. I have used IFS to separate the line text. Looks IFS is splitting text properly but while passing one of the values that has special characters in it to query, it is giving weird issue. Below is my... (2 Replies)
Discussion started by: yuvi
2 Replies

2. Shell Programming and Scripting

Storing the SQL results in array variables

Requirement 1) I need to execute 15 SQL queries in oracle through linux script. All these query results needs to be stored in array variables. Requirement 2) And these 15 queries needs to be executed in parallel. Requirement 3) Once all the queries executed then the shell script should... (3 Replies)
Discussion started by: Niranjancse
3 Replies

3. Shell Programming and Scripting

error while updating rows in sql with values in array variable

Hi, I need to update rows in a table based on the values in an array variable. code is : while read line do error_msg="$(echo $line)" index=`expr $index+1` done <"logs/$ffile" rows_count=${#error_msg } i=0 while do echo "error msgs is... (2 Replies)
Discussion started by: RP09
2 Replies

4. Shell Programming and Scripting

Pass perl array to SQL oracle

Hello, Could someone please suggest if there is a way to pass an perl array(pass @v_array) to SQL as in below eg : #!/usr/bin/perl @v_array = (1,2,4,5,6,8); $db_userid = 'ni71/ni711'; $bufTPO = qx{ sqlplus -s << EOF $db_userid set verify off set feedback off set... (1 Reply)
Discussion started by: arunshankar.c
1 Replies

5. UNIX and Linux Applications

SQL database call into Multidimensional Array using Perl Script

#!/usr/local/bin/perl use DBI; use File::Copy; use Time::Local; use Data::Dumper; -Comments Describing what I'm doing-------------- -I'm pulling information from a database that has an ID and Name. They are separated by a space and I'm trying to load them into a multidimensional array so as... (3 Replies)
Discussion started by: eazyeddie22
3 Replies

6. Shell Programming and Scripting

PERL : SQL array bind issue while grouping

Hi, I have an array of strings. Each string has 4 comma separated values. I am binding this array to a SQL where I am required to do an INSERT after grouping. The binding is done as : $insertADWSth->bind_param_array(1,A_CONSTANT_STRING);... (1 Reply)
Discussion started by: sinpeak
1 Replies

7. Shell Programming and Scripting

PERL : Bind 2D array to SQL

Hi, I am in the need of doing a bulk insert via : SQL - INSERT INTO <table> (SELECT..) OR PLSQL Block - FORALL i IN 1 .. count INSERT INTO <table>(arrayname(i)) I have a 2D array in my perl code which has the rows to be bulk inserted. Is there a way to bind the 2D array to the SQL... (4 Replies)
Discussion started by: sinpeak
4 Replies

8. UNIX for Dummies Questions & Answers

Execute PL/SQL function from Unix script (.sql file)

Hi guys, I am new on here, I have a function in oracle that returns a specific value: create or replace PACKAGE BODY "CTC_ASDGET_SCHED" AS FUNCTION FN_ASDSCHEDULE_GET RETURN VARCHAR2 AS BEGIN DECLARE ASDSchedule varchar2(6); ASDComplete... (1 Reply)
Discussion started by: reptile
1 Replies

9. Shell Programming and Scripting

unix variables from sql / pl/sql

How do I dynamically assign the below output to unix shell variables so I can build a menu in a shell script? Example: var1 = 1 var2= SYSTEM var3 = 2 var4= UNDOTBS1 and so on, then in the shell script I can use the variables to build a menu. set serveroutput on declare... (2 Replies)
Discussion started by: djehres
2 Replies

10. UNIX for Advanced & Expert Users

sql variable as array index

hi folks i am facing problom while trying to access sql variable as array index ina unix shell script....script goes as below.. #!/bin/ksh MAX=3 for elem in alpha beeta gaama do arr=$elem ((x=x+1)) Done SQL_SERVER='servername' /apps/sun5/utils/sqsh -S $SQL_SERVER -U user -P pwd -b -h... (1 Reply)
Discussion started by: sudheer157
1 Replies
Login or Register to Ask a Question