Sponsored Content
Top Forums Shell Programming and Scripting Oop to copy and rename files through SQL Statement in shell Script Post 303007296 by usman_oracle on Wednesday 15th of November 2017 05:15:36 AM
Old 11-15-2017
Oop to copy and rename files through SQL Statement in shell Script

Code:
#!/bin/sh
sqlplus -s "/ as sysdba" << EOF
SET HEADING OFF
SET FEEDBACK OFF
Select 
pt.user_concurrent_program_name , OUTFILE_NAME 
FROm 
apps.fnd_concurrent_programs_tl pt, 
apps.fnd_concurrent_requests f 
where 
pt.concurrent_program_id = f.concurrent_program_id 
and pt.application_id = f.program_application_id 
and f.RESPONSIBILITY_ID = 52431 
and trunc(f.request_date) = trunc(sysdate);

above is the code which show below output

Cotton Stock Report (Net Weight)- Customized
/opt/ora/oracle/inst/apps/PROD_darwin/logs/appl/conc/out/o16735454.out

Daily Yarn Clearance Summary Report (NCML / ESML) -Customized
/opt/ora/oracle/inst/apps/PROD_darwin/logs/appl/conc/out/o16735457.out

Lab Test - Customized
/opt/ora/oracle/inst/apps/PROD_darwin/logs/appl/conc/out/o16735462.out

first row is the report name and second row is the report output location.
now i want to write loop to copy the file from output location and save to opt/report folder , Further rename it with report name column.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

script to rename files with current date and copy it.

I have few webservers logs like access.log. which would be growing everyday. what i do everyday is, take the backup of access.log as access.log_(currentdate) and nullify the access.log. So thought of writing a script... but stuck up in middle. My requirement: to take the backup and nullify... (6 Replies)
Discussion started by: logic0
6 Replies

2. Shell Programming and Scripting

Shell Script to rename files

Hi, i need a bit of help writting a tcsh script which renames all ascii text files in the current directory by adding a number to their names before the extension so for example, a directory containing the files Hello.txt Hello.t Hello should have the following changes, Hello.txt... (2 Replies)
Discussion started by: yakuzaa
2 Replies

3. Shell Programming and Scripting

Simple BASH shell script to rename webcam jpg and copy into a new directory.

System: Ubuntu Intrepid Ibex I'm running webcamd as a sort of "security" program, but I need a script that will archive my webcam.jpg files. So, take the following file: /home/slag/www/webcam.jpg Rename it--preferably with a time stamp. Place it in say: /home/slag/www/history/ ... (4 Replies)
Discussion started by: robfindlay
4 Replies

4. Shell Programming and Scripting

using SELECT sql statement in shell script

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)
Discussion started by: hcclnoodles
4 Replies

5. Shell Programming and Scripting

Shell script to rename a group of files

Hello, I am having 1800 files in a directory with a specified format, like amms_850o_prod.000003uNy amms_850o_prod.000003u8x amms_850o_prod.000003taP amms_850o_prod.000003tKy amms_850o_prod.000003si4 amms_850o_prod.000003sTP amms_850o_prod.000003sBg amms_850o_prod.000003rvx... (12 Replies)
Discussion started by: atlantis
12 Replies

6. Shell Programming and Scripting

Help with script to copy/rename files, then delete by date

Hi All, I am new to scripting and am looking for some assistance setting up a script. Basically I need the script to scan a folder for the newest files and make a copy of those files, adding a month to the date stamp. I also need this script to delete the previously copied files to save space.... (4 Replies)
Discussion started by: Lucid13
4 Replies

7. Shell Programming and Scripting

Korn shell script - SQL statement challenges

Hi scripting experts. I have some coding challenges that I'm hoping you can help me out. I have one file#1 that contains the following sql statement that spans over multiple lines: sql Select /*+ use_has(a,b) */ * from customer a, customer_address b where a.id = b.id... (1 Reply)
Discussion started by: pchang
1 Replies

8. Shell Programming and Scripting

How to create SQL statement out of data using shell script?

Table TAB1 contains following example data (its a tree sitting in table data format & its driven based CHILD & PARENT column pick the RULE condition to generate the below SQL: CHILD PARENT SS MID MNM VNM RULE FLG 1 ? S1 ? ? V1 rule004 I 2 1 S1 ? ? V1 0 Z 3 1 S1 ? ? V1 1 Z ... (6 Replies)
Discussion started by: gksenthilkumar
6 Replies

9. Shell Programming and Scripting

Linux Script to copy and rename files through SQL statement

Hi, I require help to complete below requirement through Linux Script. I have a SQL query which shows two columns as output. One is Report Name and other is report path. Query return multiple rows. below is the output. Report Name Cotton Stock Report (Net Weight)- Customized Output... (3 Replies)
Discussion started by: usman_oracle
3 Replies
SQL::Statement::Function(3pm)				User Contributed Perl Documentation			     SQL::Statement::Function(3pm)

NAME
SQL::Statement::Function - abstract base class for all function executing terms SYNOPSIS
# this class doesn't have a common constructor, because all derived classes # have their special requirements DESCRIPTION
SQL::Statement::Function is an abstract base class providing the interface for all function executing terms. INHERITANCE
SQL::Statement::Function ISA SQL::Statement::Term METHODS
DESTROY Destroys the term and undefines the weak reference to the owner as well as the reference to the parameter list. NAME
SQL::Statement::Function::UserFunc - implements executing a perl subroutine SYNOPSIS
# create an user function term with an SQL::Statement object as owner, # specifying the function name, the subroutine name (full qualified) # and the parameters to the subroutine my $term = SQL::Statement::Function::UserFunc->new( $owner, $name, $sub, @params ); # access the result of that operation $term->value( $eval ); DESCRIPTION
SQL::Statement::Function::UserFunc implements a term which returns the result of the specified subroutine. INHERITANCE
SQL::Statement::Function ISA SQL::Statement::Term METHODS
new Instantiates a new "SQL::Statement::Function::UserFunc" instance. value Invokes the given subroutine with the values of the params and return it's result: my @params = map { $_->value($eval); } @{ $self->{PARAMS} }; return $subpkg->$subname( $self->{OWNER}, @params ); NAME
SQL::Statement::Function::NumericEval - implements numeric evaluation of a term SYNOPSIS
# create an user function term with an SQL::Statement object as owner, # specifying the expression to evaluate and the parameters to the subroutine my $term = SQL::Statement::NumericEval->new( $owner, $expr, @params ); # access the result of that operation $term->value( $eval ); DESCRIPTION
SQL::Statement::Function::NumericEval implements the numeric evaluation of a term. All parameters are expected to be numeric. INHERITANCE
SQL::Statement::Function::NumericEval ISA SQL::Statement::Function ISA SQL::Statement::Term METHODS
new Instantiates a new "SQL::Statement::Function::NumericEval" instance. Takes $owner, $expr and @params as arguments (in specified order). value Returns the result of the evaluated expression. NAME
SQL::Statement::Function::Trim - implements the built-in trim function support SYNOPSIS
# create an trim function term with an SQL::Statement object as owner, # specifying the spec, char and the parameters to the subroutine my $term = SQL::Statement::Trim->new( $owner, $spec, $char, @params ); # access the result of that operation $term->value( $eval ); DESCRIPTION
SQL::Statement::Function::Trim implements string trimming. INHERITANCE
SQL::Statement::Function::Trim ISA SQL::Statement::Function ISA SQL::Statement::Term METHODS
new Instantiates a new "SQL::Statement::Function::Trim" instance. Takes $owner, $spec, $char and @params as arguments (in specified order). Meaning of the parameters: $spec Can be on of 'LEADING', 'TRAILING' 'BOTH'. Trims the leading chars, trailing chars or at both ends, respectively. Defaults to 'BOTH'. $char The character to trim - defaults to ' ' @params Expected to be an array with exact 1 element (more aren't evaluated). value Returns the trimmed value of first parameter argument. NAME
SQL::Statement::Function::SubString - implements the built-in sub-string function support SYNOPSIS
# create an substr function term with an SQL::Statement object as owner, # specifying the start and length of the sub string to extract from the # first element of @params my $term = SQL::Statement::SubString->new( $owner, $start, $length, @params ); # access the result of that operation $term->value( $eval ); DESCRIPTION
SQL::Statement::Function::SubString implements a sub-string extraction term. INHERITANCE
SQL::Statement::Function::SubString ISA SQL::Statement::Function ISA SQL::Statement::Term METHODS
new Instantiates a new "SQL::Statement::Function::SubString" instance. Takes $owner, $start, $length and @params as arguments (in specified order). Meaning of the parameters: $start Specifies the start position to extract the sub-string. This is expected to be a SQL::Statement::Term instance. The first character in a string has the position 1. $length Specifies the length of the extracted sub-string. This is expected to be a SQL::Statement::Term instance. If omitted, everything to the end of the string is returned. @params Expected to be an array with exact 1 element (more aren't evaluated). value Returns the extracted sub-string value from first parameter argument. NAME
SQL::Statement::Function::StrConcat - implements the built-in string concatenation SYNOPSIS
# create an substr function term with an SQL::Statement object as owner # and @params to concatenate my $term = SQL::Statement::StrConcat->new( $owner, @params ); # access the result of that operation $term->value( $eval ); DESCRIPTION
SQL::Statement::Function::StrConcat implements a string concatenation term. INHERITANCE
SQL::Statement::Function::StrConcat ISA SQL::Statement::Function ISA SQL::Statement::Term METHODS
new Instantiates a new "SQL::Statement::Function::StrConcat" instance. value Returns the concatenated string composed of the parameter values. AUTHOR AND COPYRIGHT
Copyright (c) 2009,2010 by Jens Rehsack: rehsackATcpan.org All rights reserved. You may distribute this module under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file. perl v5.10.1 2011-02-01 SQL::Statement::Function(3pm)
All times are GMT -4. The time now is 06:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy