Sponsored Content
Top Forums Shell Programming and Scripting Processing values from Oracle procedure Post 302766085 by radoulov on Monday 4th of February 2013 07:09:55 AM
Old 02-04-2013
Consider the following code:

Code:
sqlplus -s <<! | while IFS= read -r; do printf 'argument: %s\n' "$REPLY"; done
/ as sysdba
set pages 0 feed off
select rownum from dual connect by rownum <= 10;
!

Or, if you don't like it all on one line:

Code:
sqlplus -s <<! | 
/ as sysdba
set pages 0 feed off
select rownum from dual connect by rownum <= 10;
!
while IFS= read -r; do 
  printf 'argument: %s\n' "$REPLY" 
done

It produces:

Code:
argument:        1
argument:        2
argument:        3
argument:        4
argument:        5
argument:        6
argument:        7
argument:        8
argument:        9
argument:       10

Substitute printf with whatever you need to do.
Note however:
- if your shell complains about the missing varname after read, use read your_varname
- if your shell complains about the -r switch, drop it
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

capturing oracle procedure out param value

I have a procedure with an out parameter, I want to use this value in a shell script, I've done this in perl before but they want this to be a ksh script. what is the syntax to do this. this was my first thought; #!/usr/bin/ksh sqlplus -s scott/tiger@db << EOF ... (1 Reply)
Discussion started by: edog
1 Replies

2. UNIX for Advanced & Expert Users

Oracle stored procedure.

I am using sqlplus. I have the stored procedure name. How can i print the stored procedure content? (2 Replies)
Discussion started by: kamil
2 Replies

3. UNIX for Dummies Questions & Answers

calling Oracle procedure from Unix

Does anyone know how to call an Oracle stored procedure from a Unix script? (1 Reply)
Discussion started by: ssmiths001
1 Replies

4. Shell Programming and Scripting

How to execute an Oracle procedure using shell

Hi , i have created an .sh file that has the following code: #!/bin/ksh sqlplus -s p1istuat/p1istuat@CWS_IST6 @Procedure_Execute.sql & sqlplus -s p1istuat/p1istuat@CWS_IST6 << EOF exit EOF The mentioned Procedure_Execute.sql file inside has the following code: exec TEST; ... (5 Replies)
Discussion started by: vins_san
5 Replies

5. Shell Programming and Scripting

Oracle procedure is not executing in uix

Hi Guys, I am trying to tun a oracle proedure throgh unix shell script but it is not running i dont know why ? i have tested this procedure in sqlplus and it was working fine. can you see the script and sql file and let me know where is my mistake. script:bm_chart_table_loading.sh ... (3 Replies)
Discussion started by: shary
3 Replies

6. Shell Programming and Scripting

passing variable to oracle procedure

using the script below I want to pass a parameters thorugh my sql call(@/unixsxxx/xxxx/helpenv.sql emptab ) as input into an oracle procedure xxxx_package.proc1(%1,emptab); . I tried %1 but it does not work. Any suggestions. #!bin/ksh set -x # export... (0 Replies)
Discussion started by: TimHortons
0 Replies

7. Shell Programming and Scripting

how to pass the values to unix shell from the oracle stored procedure.

Hi i am calling a stored procedure from unix shell like this call test_proc('0002','20100218'); the stored procedure was giving output like this dbms_output.put_line(' processed earlier'); i want to see the output in the unix shell where i called. Thanks barani (6 Replies)
Discussion started by: barani75
6 Replies

8. Shell Programming and Scripting

run oracle procedure in unix scripts

for j in $(du -h $1| awk '{printf("%100-s \n",$2)}') do for a in $(ls -time $(find $j -name '*.txt') | awk '{printf("\n%s %s %s %s %s",$4,$7,$8,$10,$11)}') do echo "$a">output.txt done done exit 0 echo "Password : xxxxxx " > LOG/BGH_$3.out (0 Replies)
Discussion started by: utoptas
0 Replies

9. Shell Programming and Scripting

Executing oracle procedure using cronjob

Hi, Below is the code to execute the procedure "dbms_job.broken" from the shell script. on executing manually, it works properly without any error. but it is not working when scheduled using the cronjob. #!/usr/bin/bash user_name="oracdb" password="ora123" tns="localdb"... (2 Replies)
Discussion started by: milink
2 Replies

10. Programming

Oracle Procedure approach

HI All , I am new to oracle procedures. Please help me for the approach to satify the requirement. I need to create procedures. with parameters passed ( say report,type,identities,country ) It should also call sql query within the procedures and passed parameters should be used in where clause... (2 Replies)
Discussion started by: Perlbaby
2 Replies
Locale::Script(3perl)					 Perl Programmers Reference Guide				     Locale::Script(3perl)

NAME
Locale::Script - standard codes for script identification SYNOPSIS
use Locale::Script; $script = code2script('phnx'); # 'Phoenician' $code = script2code('Phoenician'); # 'Phnx' $code = script2code('Phoenician', LOCALE_CODE_NUMERIC); # 115 @codes = all_script_codes(); @scripts = all_script_names(); DESCRIPTION
The "Locale::Script" module provides access to standards codes used for identifying scripts, such as those defined in ISO 15924. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default ISO 15924 four-letter codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying scripts. The ones currently supported are: alpha This is a set of four-letter (capitalized) codes from ISO 15924 such as 'Phnx' for Phoenician. This code set is identified with the symbol "LOCALE_SCRIPT_ALPHA". The Zxxx, Zyyy, and Zzzz codes are not used. This is the default code set. numeric This is a set of three-digit numeric codes from ISO 15924 such as 115 for Phoenician. This code set is identified with the symbol "LOCALE_SCRIPT_NUMERIC". ROUTINES
code2script ( CODE [,CODESET] ) script2code ( NAME [,CODESET] ) script_code2code ( CODE ,CODESET ,CODESET2 ) all_script_codes ( [CODESET] ) all_script_names ( [CODESET] ) Locale::Script::rename_script ( CODE ,NEW_NAME [,CODESET] ) Locale::Script::add_script ( CODE ,NAME [,CODESET] ) Locale::Script::delete_script ( CODE [,CODESET] ) Locale::Script::add_script_alias ( NAME ,NEW_NAME ) Locale::Script::delete_script_alias ( NAME ) Locale::Script::rename_script_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Script::add_script_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Script::delete_script_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes man page. SEE ALSO
Locale::Codes Locale::Constants http://www.unicode.org/iso15924/ Home page for ISO 15924. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 1997-2001 Canon Research Centre Europe (CRE). Copyright (c) 2001-2010 Neil Bowers Copyright (c) 2010-2011 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2011-09-26 Locale::Script(3perl)
All times are GMT -4. The time now is 11:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy