Hello
I would like to perform a select from a oracle table and return those values to my shell script
For example:
site=head -1 $infile | cut -c1-15 | awk '{printf "s%", $0}
sqlplus -s /nolog |& #Open pipe to sql
select col1, col2, col3, col4
from oracle_table
where col5 =... (6 Replies)
If I recall, when I used informix I could do a sql statement like:
SELECT Value from Table WHERE ID in (100,200,300);
How do I do this in Oracle? I believe I am using Oracle 10 if that matters.
Thanks. (1 Reply)
Hi there
I have a database on a remote box and i have been using shell script to insert data into it for example, i could have a script that did this
SN=123456
n=server1
m=x4140
sql="UPDATE main SET hostname='$n',model='$m' WHERE serial='$SN';"
echo $sql |/usr/sfw/bin/mysql -h... (4 Replies)
I am trying to assign an select statement into a variable. Can someone hel me with this.
example :
a='select * from dual'
echo $a should give me select * from dual
But this is not working. I trying with \ before * and quotes too. (1 Reply)
i want to select a variable created and use it in a if statement, but not getting the desired results
LINE='device for 0101a01: lpd://172.25.41.111:515'
prt=`echo $LINE | awk '{print $3 }' | cut -c 1-7`
echo $prt
My if statement to select just what i want..
IFS=$":"
while read prt... (11 Replies)
Hello All,
I am new to shell scripting. I am working on Solaris O/S, bash script and sybase programming.
I want to loop through multiple values in an array and for each value, I
want to select a row from the database.
following is the code written for it.
output="loop.csv" ... (8 Replies)
Hello all, I tried searching for something similiar before posting but couldn't come up with anything that fit what I need.
In Linux, I'm trying to parse through a number of files and take the info in them and put it into mysql. My file is a dump from an expect script:
---filename... (3 Replies)
Hi
I have run out of ideas as to why this select doesn't work in a script I am writing.
The script sources a file of common functions and I am trying to use a select statement within one of the functions -
PS3="Try? "
select X in CONT EXIT; do
if ]
... (4 Replies)
Hello,
I am fairly new to shellscripting and have written a script to check on messages file and report failed logins:
Here is the original file:
Jul 17 03:38:07 sfldmilx086 sshd: error: PAM: Authentication failure for houghn97 from 10.135.77.201
Jul 17 03:38:07 sfldmilx086 sshd: error:... (2 Replies)
Hi all,
I'm using below code
processId=`sqlplus -s ${sysuser}/${syspwd} <<CHK_PROCESS
whenever sqlerror exit sql.sqlcode;
set head off feedback off echo off pages 0
SELECT PROCESS_ID FROM LSHADMIN.DATA_DOMAIN WHERE DOMAIN_NAME = '${tabname}'
... (8 Replies)
Discussion started by: Pratiksha Mehra
8 Replies
LEARN ABOUT OSX
sql::abstract::tree
SQL::Abstract::Tree(3) User Contributed Perl Documentation SQL::Abstract::Tree(3)NAME
SQL::Abstract::Tree - Represent SQL as an AST
SYNOPSIS
my $sqla_tree = SQL::Abstract::Tree->new({ profile => 'console' });
print $sqla_tree->format('SELECT * FROM foo WHERE foo.a > 2');
# SELECT *
# FROM foo
# WHERE foo.a > 2
METHODS
new
my $sqla_tree = SQL::Abstract::Tree->new({ profile => 'console' });
$args = {
profile => 'console', # predefined profile to use (default: 'none')
fill_in_placeholders => 1, # true for placeholder population
placeholder_surround => # The strings that will be wrapped around
[GREEN, RESET], # populated placeholders if the above is set
indent_string => ' ', # the string used when indenting
indent_amount => 2, # how many of above string to use for a single
# indent level
newline => "
", # string for newline
colormap => {
select => [RED, RESET], # a pair of strings defining what to surround
# the keyword with for colorization
# ...
},
indentmap => {
select => 0, # A zero means that the keyword will start on
# a new line
from => 1, # Any other positive integer means that after
on => 2, # said newline it will get that many indents
# ...
},
}
Returns a new SQL::Abstract::Tree object. All arguments are optional.
profiles
There are four predefined profiles, "none", "console", "console_monochrome", and "html". Typically a user will probably just use "console"
or "console_monochrome", but if something about a profile bothers you, merely use the profile and override the parts that you don't like.
format
$sqlat->format('SELECT * FROM bar WHERE x = ?', [1])
Takes $sql and "@bindargs".
Returns a formatting string based on the string passed in
parse
$sqlat->parse('SELECT * FROM bar WHERE x = ?')
Returns a "tree" representing passed in SQL. Please do not depend on the structure of the returned tree. It may be stable at some point,
but not yet.
unparse
$sqlat->unparse($tree_structure, @bindargs)
Transform "tree" into SQL, applying various transforms on the way.
format_keyword
$sqlat->format_keyword('SELECT')
Currently this just takes a keyword and puts the "colormap" stuff around it. Later on it may do more and allow for coderef based
transforms.
pad_keyword
my ($before, $after) = @{$sqlat->pad_keyword('SELECT')};
Returns whitespace to be inserted around a keyword.
fill_in_placeholder
my $value = $sqlat->fill_in_placeholder(@bindargs)
Removes last arg from passed arrayref and returns it, surrounded with the values in placeholder_surround, and then surrounded with single
quotes.
indent
Returns as many indent strings as indent amounts times the first argument.
ACCESSORS
colormap
See "new"
fill_in_placeholders
See "new"
indent_amount
See "new"
indent_string
See "new"
indentmap
See "new"
newline
See "new"
placeholder_surround
See "new"
perl v5.16.2 2012-06-14 SQL::Abstract::Tree(3)