Showing posts with label oracle EBS. Show all posts
Showing posts with label oracle EBS. Show all posts

Shell Script tutorial - how to use shell script oracle Apps

2 comments

Use of shell script in oracle

A.Steps to Register Shell Script as a concurrent program.

B.Sample Shell Script to copy the file from source to destination.

C.Basic Shell Script Commands.

A. Steps to Register Shell Script as a concurrent program : 

Step 1:
=======
Place the .prog script under the bin directory for your applications top directory.

For example, call the script ONEPLACE_DEMO.prog and place it under $CUSTOM_TOP/bin
(*Note: $CUSTOM_TOP = name of you custom top)

Go to $CUSTOM_TOP/bin where you have places shell script file and run below command to give full permission to file.

chmod 777 .prog

step 2:
=======
Make a symbolic link from your script to $FND_TOP/bin/fndcpesr in $CUSTOM_TOP/bin directory.

For example, if the script is called ONEPLACE_DEMO.prog use this:

ln -s $FND_TOP/bin/fndcpesr ONEPLACE_DEMO

This link will be having same name as your script without the .prog extension.
step 3:
=======
Register the concurrent program, using an execution method as 'Host'. Use the name of your script without the .prog extension as the name of the executable.
For the example above:
Use ONEPLACE_DEMO as name of the executable file.
step 4:
=======
Your script will be passed at least 4 parameters, from $1 to $4.

$1 = orauser/pwd
$2 = userid(apps)
$3 = username,
$4 = request_id

Any other parameters you define will be passed in as $5 and higher.
Make sure your script returns an exit status.

B.Sample Shell Script to copy the file from source to destination

Shell Script to copy the file from source to destination

#Note: If you see # in front of any line it means that it’s a comment line not the actual code
#** ********************************************************************
# Created By : Oneplace World Blogspot
# Creation Date : 18-OCT-2016
# Script Name : ONEPLACE_DEMO.prog
# Description : This Script accepts three parameters
# 1)Data File Name 2)Source Directory Path 3)Target Directory Path
# Then copy the file from source location to target location.
# If copy fails send the error status/message to concurrent program so that user can see status.
#
#
# ========
# History
# ========
# Version 1 Oneplace World Blogspot 18-OCT-2016 Created for http://oneplaceworld.blogspot.in/ users
#
#** ********************************************************************
#Parameters from 1 to 4 i.e $1 $2 $3 $4 are standard parameters
# $1 : username/password of the database
# $2 : userid
# $3 : USERNAME
# $4 : Concurrent Request ID
DataFileName=$5
SourceDirectory=$6
TargetDirectory=$7
echo "————————————————–"
echo "Parameters received from concurrent program .."
echo " Time : "'date'
echo "————————————————–"
echo "Arguments : "
echo " Data File Name : "${DataFileName}
echo " SourceDirectory : "${SourceDirectory}
echo " TargetDirectory : "${TargetDirectory}
echo "————————————————–"
echo " Copying the file from source directory to target directory…"
cp ${SourceDirectory}/${DataFileName} ${TargetDirectory}
if [ $? -ne 0 ]
# the $? will contain the result of previously executed statement.
#It will be 0 if success and 1 if fail in many cases
# -ne represents not “equal to”
then
echo "Entered Exception"
exit 1
# exit 1 represents concurrent program status. 1 for error, 2 for warning 0 for success
else
echo "File Successfully copied from source to destination"
exit 0
fi
echo "****************************************************************"
#End of Shell Script File

C.Basic Shell Script Commands :

# Create Directory
mkdir
# Remove Directory
rmdir
#remove folder with files
rm -r -f
# Change Directory
cd
# Create new file
vi
#insert data into file
vi
esc i
#Save file
esc :wq enter
# exit without saving changes
esc :q! enter
# open existing file
vi
#remove file
rm
# Move file with same name
mv /
# move file with data appended to filename in the front
mv / /'date+%H%M%d%m%y'
# copy file with same name
cp /
# copy file with new name
cp / /
#print line
echo "your text here to print"
#print date
echo 'date'
#grep – This is one of the most powerful and useful commands available to you in Linux. It stands for Global/Regular Expression Print. It looks through a file and prints any line that matches a particular pattern. Because this pattern is based on "regular expression," a concise line can yield a multitude of patterns to be matched. For not, though, you can enter a tern for searching.(grep is case sensitive)
grep pattern_file
#You can use the “-i” flag to make it ignore case.
ls / | grep -i pattern_file
#Piping, or Chaining Piping is so named because it uses the pipe, (| ; shared with the \ key on most keyboards). Essentially, it takes the output of one command and directly feeds it to another. You can create long chains of commands to get a very specific desired output this way, and it’s very convenient for commands like grep.

ls / | grep pattern_file
Read More

Query to Fetch Credit Card Details and CVV of a customer in oracle-R12

Leave a Comment

Query to fetch credit card details and secured CVV number

select hca.cust_account_id,
       hca.party_id,
       hcas.party_site_id,
       hca.account_number "CUSTOMER",
       CreditCardEO.CARD_ISSUER_CODE "CARD TYPE",
       CreditCardEO.CCNUMBER "CARD NUMBER",
       CreditCardEO.EXPIRYDATE "EXP DATE",
       hp.party_name "OWNER NAME",
       hcsu.location,
       CreditCardEO.DESCRIPTION "CARDHOLDER NAME",
       CreditCardEO.INVALIDATION_REASON,
       trunc(ipiu.start_date) "VALID FROM",
       (select iss.SEGMENT_CIPHER_TEXT
          from apps.iby_fndcpt_tx_extensions extn,
               IBY.IBY_SECURITY_SEGMENTS     iss
         where 1 = 1
           and extn.instr_assignment_id = ipiu.instrument_payment_use_id
           and extn.INSTR_CODE_SEC_SEGMENT_ID = iss.SEC_SEGMENT_ID
           and rownum = 1) CVV
  from apps.hz_cust_accounts_all   hca,
       apps.hz_cust_acct_sites_all hcas,
       apps.hz_cust_site_uses_all  hcsu,
       apps.HZ_PARTY_SITE_USES     hpsu,
       apps.IBY_CREDITCARD         CreditCardEO,
       apps.IBY_PMT_INSTR_USES_ALL ipiu,
       apps.hz_parties             hp
 where 1 = 1
   and hca.party_id = hp.party_id
   and hca.cust_account_id = hcas.cust_account_id
   and hcas.cust_acct_site_id = hcsu.cust_acct_site_id
   and hcas.party_site_id = hpsu.party_site_id
   and hpsu.SITE_USE_TYPE = 'CC_BILLING'
   AND CreditCardEO.INSTRID = ipiu.instrument_id
   AND ipiu.INSTRUMENT_TYPE = 'CREDITCARD'
   AND CreditCardEO.CARD_OWNER_ID = hp.party_id
   and hcsu.site_use_code = 'BILL_TO'
   and hcsu.org_id = 'required_operating_unit_id' -- pass operting unit id
 order by customer, CreditCardEO.DESCRIPTION



{*Note : Before sharing cvv number,first check with proper requirement  from security point of view                and policy of your organization and client}.



Read More