Oracle To Korn Shell Array


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Oracle To Korn Shell Array
# 1  
Old 09-20-2002
Question Oracle To Korn Shell Array

I'm attempting to populate an array in ksh using the following command:

set -A $(SELECT_INVOICE | sed '/^$/d')

SELECT_INVOICE is a function that executes the SQL query.

Problem: Some of the invoice numbers have alpha characters with spaces(example: OVEN MICRO). The Korn shell is treating OVEN and MICRO as separate indexed array elements. Does anyone have a suggestion as to how to work around this issue?
# 2  
Old 09-24-2002
There can be a possibility.

1)Each of the results from SQL query should be enclosed in single
quotes 'OVEN MACRO' then pass it to array so that ksh doesn't
treat them as seperate arguments

2)Insert one special character underscore in between
OVEN_MACRO and pass it to array and later remove them


Cheers
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

pass value from Oracle sql to Korn shell

Hi All , I am trying to pass a value from sqlplus to korn shell . There is a table tab1 in Oracle that has a column userdate. I need to pass the userdate to the korn shell . This is what I am doing . VALUE=`sqlplus -silent username/password << END set pagesize 0 feedback off verify off... (14 Replies)
Discussion started by: megha2525
14 Replies

2. Shell Programming and Scripting

'*' vs. '@' in Korn Shell Array Variables

In order to use the shellcurses functions described at: Shell Curses function library I am learning about ksh, which has arrays. My trusty Kochan & Wood book says that for any Korn Shell array AR : ${AR } expands to all the defined array elements, and ${#AR } expands to the number... (3 Replies)
Discussion started by: Clovis_Sangrail
3 Replies

3. Shell Programming and Scripting

Korn Shell Array maximum value less than other value

I have a text file with several key words that I am trying to isolate. I have grepped for the unknowns in the text file, but each unknown has a corresponding location. I have created an array that holds all the unknowns and another array that holds all of the locations and compares them based on... (12 Replies)
Discussion started by: ther2000
12 Replies

4. Shell Programming and Scripting

Generate array name at run time Korn shell

Hi, I am trying to define number of array based on constant derived during execution phase of a script. Here is what i am trying.. #First Part, Get LUN input from User lun_count=4 count=0 set -A my_lun while : do while ]; do read L?"Enter Lun "$count" Number:" ... (2 Replies)
Discussion started by: harris2107
2 Replies

5. UNIX for Advanced & Expert Users

Need Help for Using Oracle Cursors in Shell Script Korn

Hi, My Oracle Stored procedure returns sys_refcursor to shell script. I have to iterate through it in script and use those retrieved values further in my script. I am using K Shell Scrpting. Stored Procedure is: create or replace PROCEDURE p_test(job_id IN VARCHAR2, c1 OUT SYS_REFCURSOR)... (0 Replies)
Discussion started by: rajeshorpu
0 Replies

6. Shell Programming and Scripting

need help with korn shell array

I have a korn shell script that reads a file with just one column in the file. If the file has more than 5 entries it is split using split -5. This means that is we have 15 entries I will end up with 3 files with 5 entries/lines in each and if I have 23 entries I will end up with 5 files with the... (2 Replies)
Discussion started by: kieranfoley
2 Replies

7. Shell Programming and Scripting

Korn Shell and Oracle

Hi Guys, I haven't worked on oracle much but I have a situation where I have to do bdf in all the servers and insert that information into oracle table. I have already created table which have 7 columns, I can insert manually but I dont know how to insert that using Korn shell. SERVER_ID ... (9 Replies)
Discussion started by: pareshan
9 Replies

8. Shell Programming and Scripting

I can't decalar an array in my korn shell script

I have a script that contains #!/usr/bin/ksh set -A X 'hallo' 'world' echo ${X} echo ${X} when I execute it I get an errror message sh ./test.ksh ./test.ksh: -A: bad option(s) but if I do this at the command prompt I am able to create it set -A myarray '1' '2' '3' echo ${myarray}... (4 Replies)
Discussion started by: zilla30066
4 Replies

9. Shell Programming and Scripting

korn shell array?

I read it is possible to provide values for an array with the -A option to the read statement; however, I have not been able to get this to work. When I execute a script with the -A option to the read statement, the shell complains that it is an illegal option. If this works, can someone provide... (5 Replies)
Discussion started by: cstovall
5 Replies

10. UNIX for Dummies Questions & Answers

Executing Oracle Stored Procs from Korn Shell

Can someone tell me how to execute an Oracle Stored Procedure from a Korn Shell Script. Previously, I'm able to execute standard sql using the following:- The_Output=`sqlplus................. << EOF select count(*) from abc / ... (3 Replies)
Discussion started by: Vinny_Mitchell
3 Replies
Login or Register to Ask a Question