Sponsored Content
Top Forums Shell Programming and Scripting ksh and Oracle stored procedure output in logfile Post 302931744 by rbatte1 on Thursday 15th of January 2015 08:18:21 AM
Old 01-15-2015
You don't assign values to the special variables $1, $2, $3, etc. in ksh, these are on the command line, so if your script is called my_script, you would run it like this:-
Code:
my_script 10 30 50 201440114

I would then presume that you need to pass them to the sqlplus command in the same way so that it can read them in too, although I thought that they were referred to as &1, &2, &3, etc. within SQL.



I hope that this helps,

Robin
 

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

Execute an Oracle stored procedure from a shell scrip

Here is a snippet of my code: if then echo "\n Deleting all reports older than 24 hours. \n" >> $logfile ls -l $FileName >> $logfile ... (1 Reply)
Discussion started by: mh53j_fe
1 Replies

3. Shell Programming and Scripting

Shell arrays in oracle stored procedure

Is it possible to pass unix shell arrays in Oracle stored procedure? Is yes, how? Thanks (6 Replies)
Discussion started by: superprogrammer
6 Replies

4. Shell Programming and Scripting

calling a PL/SQL stored procedure from KSH

Hi I have a stored procedure which should be called from KSH. Could ayone please help me with this. Thanks (1 Reply)
Discussion started by: BlAhEr
1 Replies

5. Shell Programming and Scripting

Invoking Oracle stored procedure in unix shell script

Here's a shell script snippet..... cd $ORACLE_HOME/bin Retval=`sqlplus -s <<eof $TPDB_USER/april@$TPD_DBCONN whenever SQLERROR exit 2 rollback whenever OSERROR exit 3 rollback set serveroutput on set pages 999 var status_desc char(200) var status_code... (1 Reply)
Discussion started by: hidnana
1 Replies

6. 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

7. Shell Programming and Scripting

how to call oracle stored procedure from unix shell

Hi i want to call a oracle stored procedure from unix (using bash shell). consider this is my oracle stored procedure with parameter create procedure testproc(name IN varchar, age IN Number, id OUT Number ) AS begin id=1; dbms_output.put.line('successfull validation') end;... (6 Replies)
Discussion started by: barani75
6 Replies

8. Shell Programming and Scripting

Call and redirect output of Oracle stored procedure from unix script

Hi, Can you assist me in how to redirect the output of oracle stored procedure from unix script? Something similar to what i did for sybase isql -U$MYDBLOG -D$MYDBNAME -S$MYDBSVR -P$MYDBPWD -o$MYFILE<< %% proc_my_test 8 go %% Thanks in advance - jak (0 Replies)
Discussion started by: jakSun8
0 Replies

9. Shell Programming and Scripting

Need to run Oracle stored procedure from UNIX env

Hi Everyone, I want to create a script where i need to run the oracle stored procedure from unix script and get the output(sequence number ) into a variable which i will pass in my datastage job. Below is my stored procedure:- DECLARE P_TRANSTYPE VARCHAR2(20); ... (4 Replies)
Discussion started by: prasson_ibm
4 Replies

10. Shell Programming and Scripting

Calling Oracle stored procedure from ksh script

Friends, I'm newbie with ksh so wanting some help.... 1. I'm trying to call oracle stored procedure from ksh script by taking variable value from runtime, feed into script and execute procedure. 2. Put name1 and name2 value from script run replacing $3 & $4 I'm trying to put name1 in... (4 Replies)
Discussion started by: homer4all
4 Replies
MouseX::Getopt(3pm)					User Contributed Perl Documentation				       MouseX::Getopt(3pm)

NAME
MouseX::Getopt - A Mouse role for processing command line options SYNOPSIS
## In your class package My::App; use Mouse; with 'MouseX::Getopt'; has 'out' => (is => 'rw', isa => 'Str', required => 1); has 'in' => (is => 'rw', isa => 'Str', required => 1); # ... rest of the class here ## in your script #!/usr/bin/perl use My::App; my $app = My::App->new_with_options(); # ... rest of the script here ## on the command line % perl my_app_script.pl -in file.input -out file.dump DESCRIPTION
This is a role which provides an alternate constructor for creating objects using parameters passed in from the command line. This module attempts to DWIM as much as possible with the command line params by introspecting your class's attributes. It will use the name of your attribute as the command line option, and if there is a type constraint defined, it will configure Getopt::Long to handle the option accordingly. You can use the trait MouseX::Getopt::Meta::Attribute::Trait or the attribute metaclass MouseX::Getopt::Meta::Attribute to get non-default commandline option names and aliases. You can use the trait MouseX::Getopt::Meta::Attribute::Trait::NoGetopt or the attribute metaclass MouseX::Getopt::Meta::Attribute::NoGetopt to have "MouseX::Getopt" ignore your attribute in the commandline options. By default, attributes which start with an underscore are not given commandline argument support, unless the attribute's metaclass is set to MouseX::Getopt::Meta::Attribute. If you don't want your accessors to have the leading underscore in their name, you can do this: # for read/write attributes has '_foo' => (accessor => 'foo', ...); # or for read-only attributes has '_bar' => (reader => 'bar', ...); This will mean that Getopt will not handle a --foo param, but your code can still call the "foo" method. If your class also uses a configfile-loading role based on MouseX::ConfigFromFile, such as MouseX::SimpleConfig, MouseX::Getopt's "new_with_options" will load the configfile specified by the "--configfile" option (or the default you've given for the configfile attribute) for you. Options specified in multiple places follow the following precedence order: commandline overrides configfile, which overrides explicit new_with_options parameters. Supported Type Constraints Bool A Bool type constraint is set up as a boolean option with Getopt::Long. So that this attribute description: has 'verbose' => (is => 'rw', isa => 'Bool'); would translate into "verbose!" as a Getopt::Long option descriptor, which would enable the following command line options: % my_script.pl --verbose % my_script.pl --noverbose Int, Float, Str These type constraints are set up as properly typed options with Getopt::Long, using the "=i", "=f" and "=s" modifiers as appropriate. ArrayRef An ArrayRef type constraint is set up as a multiple value option in Getopt::Long. So that this attribute description: has 'include' => ( is => 'rw', isa => 'ArrayRef', default => sub { [] } ); would translate into "includes=s@" as a Getopt::Long option descriptor, which would enable the following command line options: % my_script.pl --include /usr/lib --include /usr/local/lib HashRef A HashRef type constraint is set up as a hash value option in Getopt::Long. So that this attribute description: has 'define' => ( is => 'rw', isa => 'HashRef', default => sub { {} } ); would translate into "define=s%" as a Getopt::Long option descriptor, which would enable the following command line options: % my_script.pl --define os=linux --define vendor=debian Custom Type Constraints It is possible to create custom type constraint to option spec mappings if you need them. The process is fairly simple (but a little verbose maybe). First you create a custom subtype, like so: subtype 'ArrayOfInts' => as 'ArrayRef' => where { scalar (grep { looks_like_number($_) } @$_) }; Then you register the mapping, like so: MouseX::Getopt::OptionTypeMap->add_option_type_to_map( 'ArrayOfInts' => '=i@' ); Now any attribute declarations using this type constraint will get the custom option spec. So that, this: has 'nums' => ( is => 'ro', isa => 'ArrayOfInts', default => sub { [0] } ); Will translate to the following on the command line: % my_script.pl --nums 5 --nums 88 --nums 199 This example is fairly trivial, but more complex validations are easily possible with a little creativity. The trick is balancing the type constraint validations with the Getopt::Long validations. Better examples are certainly welcome :) Inferred Type Constraints If you define a custom subtype which is a subtype of one of the standard "Supported Type Constraints" above, and do not explicitly provide custom support as in "Custom Type Constraints" above, MouseX::Getopt will treat it like the parent type for Getopt purposes. For example, if you had the same custom "ArrayOfInts" subtype from the examples above, but did not add a new custom option type for it to the "OptionTypeMap", it would be treated just like a normal "ArrayRef" type for Getopt purposes (that is, "=s@"). METHODS
new_with_options (%params) This method will take a set of default %params and then collect params from the command line (possibly overriding those in %params) and then return a newly constructed object. The special parameter "argv", if specified should point to an array reference with an array to use instead of @ARGV. If "GetOptions" in Getopt::Long fails (due to invalid arguments), "new_with_options" will throw an exception. If Getopt::Long::Descriptive is installed and any of the following command line params are passed, the program will exit with usage information (and the option's state will be stored in the help_flag attribute). You can add descriptions for each option by including a documentation option for each attribute to document. --? --help --usage If you have Getopt::Long::Descriptive the "usage" param is also passed to "new" as the usage option. ARGV This accessor contains a reference to a copy of the @ARGV array as it originally existed at the time of "new_with_options". extra_argv This accessor contains an arrayref of leftover @ARGV elements that Getopt::Long did not parse. Note that the real @ARGV is left un- mangled. usage This accessor contains the Getopt::Long::Descriptive::Usage object (if Getopt::Long::Descriptive is used). help_flag This accessor contains the boolean state of the --help, --usage and --? options (true if any of these options were passed on the command line). meta This returns the role meta object. AUTHORS
o NAKAGAWA Masaki <masaki@cpan.org> o FUJI Goro <gfuji@cpan.org> o Stevan Little <stevan@iinteractive.com> o Brandon L. Black <blblack@gmail.com> o Yuval Kogman <nothingmuch@woobling.org> o Ryan D Johnson <ryan@innerfence.com> o Drew Taylor <drew@drewtaylor.com> o Tomas Doran <bobtfish@bobtfish.net> o Florian Ragwitz <rafl@debian.org> o Dagfinn Ilmari Mannsaker <ilmari@ilmari.org> o Avar Arnfjord Bjarmason <avar@cpan.org> o Chris Prather <perigrin@cpan.org> o Mark Gardner <mjgardner@cpan.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-03-21 MouseX::Getopt(3pm)
All times are GMT -4. The time now is 05:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy