Sponsored Content
Top Forums Shell Programming and Scripting Storing the SQL results in array variables Post 302843687 by verdepollo on Wednesday 14th of August 2013 12:19:30 PM
Old 08-14-2013
We're not Unix consultants that work to solve user requirements.

Here's a start using heredoc:
Code:
output=$(sqlplus <...> <<EOF
start $1.sql
quit
EOF
)
echo $output

Unfortunately that's a pretty vague answer, but it would be easier if you posted specific questions and not the whole requirement.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem while storing sql query value in a variable

Hi, When i execute the below statement , the value is not getting stored in the variable. AnneeExercice=`sqlplus $LOGSQL/$PASSWORDSQL << FIN >> $GEMOLOG/gemo_reprev_reel_data_ventil_$filiale.trc SELECT bi09exercice FROM bi09_scenario WHERE bi09idfiliale=UPPER('de') AND ... (1 Reply)
Discussion started by: krishna_gnv
1 Replies

2. Shell Programming and Scripting

storing variables in array.Please help

Hi All, I need some help with arrays. I need to take input from the user for hostname, username and password until he enters .(dot) or any other character and store the values in the variable array. I would further connect to the hostname using username and passwd and copy files from server to... (7 Replies)
Discussion started by: nua7
7 Replies

3. Shell Programming and Scripting

Storing commands in $variables.

Hi I'm trying to store commands in variables... like so.. # lastcmd=" $t1 | $t2 | $t3 | $t4 | sort | uniq" t1="sed -e 's/http:/<li><a href=\"http:/'" t2="sed -e 's/http:.*/&\">&<\/a>Web Link<br>/'" t3="sed -e 's/.*. mailto:/<li><a href=\"mailto:/'" t4="sed -e... (7 Replies)
Discussion started by: Paulw0t
7 Replies

4. Shell Programming and Scripting

perl: storing regex in array variables trouble

hi this is an example of code: use strict; use warnings; open FILE, "/tmp/result_2"; my $regex="\\ Starting program ver. (.*)"; my $res="Program started, version <$1> - OK.\n"; while (<FILE>) { if ($_ =~ /($regex)/) { print "$res"; } } close FILE; This finds $regex and print... (3 Replies)
Discussion started by: xist
3 Replies

5. UNIX for Dummies Questions & Answers

Storing variables and using them..

Hello Apologies for not having the most accurate of thread titles.. I'm using IBM Rational Synergy CM software. I use the Synergy commands in tandem with Unix commands. I have a directory containing source code objects: bash-3.00$ ccm ls *.fmb *.rdf *.pll *.mmb cre_applications.fmb-1... (1 Reply)
Discussion started by: Glyn_Mo
1 Replies

6. Shell Programming and Scripting

Storing outputs into variables

I need to know how to store output from one command so that it can initiate another command. chktraf -s | cut -c1-4 output would look like 321 142 256 342 123 Then if the value of the output = 0, then initiate next command. if then for xx in 01 02 03 04 05 06 07 08 09 10 do ... (4 Replies)
Discussion started by: Shaun74
4 Replies

7. Shell Programming and Scripting

SQL/Plus in a coprocess example. Also saves query results into shell variables

While assisting a forum member, I recommended running SQL/Plus in a coprocess (to make database connections and run a test script) for the duration of his script rather than starting/stopping it once for every row in a file he was processing. I recalled I made a coprocess example for folks at... (2 Replies)
Discussion started by: gary_w
2 Replies

8. Shell Programming and Scripting

How to store results of multiple sql queries in shell variables in ksh?

Hi, I have a script where I make a sqlplus connection. In the script I have multiple sql queries within that sqlplus connection. I want the result of the queries to be stored in shell variables declared earlier. I dont want to use procedures. Is there anyway else. Thanks in advance.. Cheers (6 Replies)
Discussion started by: gonchusirsa
6 Replies

9. Shell Programming and Scripting

How to Assign SQL Query Results to Variables in Linux?

Hi, I am new to linux... How to Assign SQL Query Results to Variables in Linux,i want ti generate it in param files, Can anyone please explain me. Ex: SQL> Select * from EMP; O/P: Emp_No Emp_Name 1 AAA 2 BBB 3 CCC and I want expected... (5 Replies)
Discussion started by: Sravana Kumar
5 Replies

10. Shell Programming and Scripting

Storing multiple sql queries output into variable by running sql command only once

Hi All, I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise. Eg : Select 'Query 1 output' from dual; Select 'Query 2 output' from dual; I want to... (3 Replies)
Discussion started by: Rokkesh
3 Replies
PPI::Token::HereDoc(3)					User Contributed Perl Documentation				    PPI::Token::HereDoc(3)

NAME
PPI::Token::HereDoc - Token class for the here-doc INHERITANCE
PPI::Token::HereDoc isa PPI::Token isa PPI::Element DESCRIPTION
Here-docs are incredibly handy when writing Perl, but incredibly tricky when parsing it, primarily because they don't follow the general flow of input. They jump ahead and nab lines directly off the input buffer. Whitespace and newlines may not matter in most Perl code, but they matter in here-docs. They are also tricky to store as an object. They look sort of like an operator and a string, but they don't act like it. And they have a second section that should be something like a separate token, but isn't because a strong can span from above the here-doc content to below it. So when parsing, this is what we do. Firstly, the PPI::Token::HereDoc object, does not represent the "<<" operator, or the "END_FLAG", or the content, or even the terminator. It represents all of them at once. The token itself has only the declaration part as its "content". # This is what the content of a HereDoc token is <<FOO # Or this <<"FOO" # Or even this << 'FOO' That is, the "operator", any whitespace separator, and the quoted or bare terminator. So when you call the "content" method on a HereDoc token, you get '<< "FOO"'. As for the content and the terminator, when treated purely in "content" terms they do not exist. The content is made available with the "heredoc" method, and the name of the terminator with the "terminator" method. To make things work in the way you expect, PPI has to play some games when doing line/column location calculation for tokens, and also during the content parsing and generation processes. Documents cannot simply by recreated by stitching together the token contents, and involve a somewhat more expensive procedure, but the extra expense should be relatively negligible unless you are doing huge quantities of them. Please note that due to the immature nature of PPI in general, we expect "HereDocs" to be a rich (bad) source of corner-case bugs for quite a while, but for the most part they should more or less DWYM. Comparison to other string types Although technically it can be considered a quote, for the time being "HereDocs" are being treated as a completely separate "Token" subclass, and will not be found in a search for PPI::Token::Quote or "PPI::Token::QuoteLike objects". This may change in the future, with it most likely to end up under QuoteLike. METHODS
Although it has the standard set of "Token" methods, "HereDoc" objects have a relatively large number of unique methods all of their own. heredoc The "heredoc" method is the authoritative method for accessing the contents of the "HereDoc" object. It returns the contents of the here-doc as a list of newline-terminated strings. If called in scalar context, it returns the number of lines in the here-doc, excluding the terminator line. terminator The "terminator" method returns the name of the terminating string for the here-doc. Returns the terminating string as an unescaped string (in the rare case the terminator has an escaped quote in it). TO DO
- Implement PPI::Token::Quote interface compatibility - Check CPAN for any use of the null here-doc or here-doc-in-s///e - Add support for the null here-doc - Add support for here-doc in s///e SUPPORT
See the support section in the main module. AUTHOR
Adam Kennedy <adamk@cpan.org> COPYRIGHT
Copyright 2001 - 2011 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.16.3 2011-02-26 PPI::Token::HereDoc(3)
All times are GMT -4. The time now is 07:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy