Extract Oracle sql queries from .fmb and .rdf files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Extract Oracle sql queries from .fmb and .rdf files
# 1  
Old 08-21-2014
Extract Oracle sql queries from .fmb and .rdf files

Hi all,

Quote:
Is it possible to extract oracle sql queries from .fmb and .rdf files?

Requirement

Pass .fmb or .rdf file as a parameter to the unix shell script that generates explain plan statistics?
Thanks for your time!

Regards,
# 2  
Old 08-22-2014
Use strings uaampay.fmb | egrep -i '(select|insert|update|delete)'

Gives you something like this:
Code:
select utrpycd_code, utrpycd_desc from utrpycd where utrpycd_rev_loc_id 
= (select uzrcloc_rev_loc_id from uzrcloc where uzrcloc_cash_drawer_user_id = :key_block.cash_drawer_user_id)
select utvasvc_code, utvasvc_desc from utvasvc where utvasvc_desc not like 'Elec%' order by utvasvc_code
select utvresv_code, utvresv_desc from utvresv where utvresv_desc not like 'Elec%' and utvresv_desc not like 'Good%' order by utvresv_code
select '1' acci, '2' title, '3' status, '4' eff, '5' term from dual
select '1' fund, '2' title, '3' ftyp, '4' entry, '5' status, '6' eff, '7' term from dual
select '1' locn, '2' title, '3' status, '4' eff, '5' term from dual
select '1' prog, '2' title, '3' entry, '4' status, '5' eff, '6' term from dual
select '1' acct, '2' title, '3' atyp, '4' entry, '5' status, '6' eff, '7' term from dual
select '1' ccen, '2' title, '3' entry, '4' status, '5' eff, '6' term from dual
select '1' coas, '2' title, '3' status, '4' eff, '5' term from dual
select '1' rucl, '2' title, '3' type, '4' status, '5' eff, '6' term from dual
select '1' prog, '2' title, '3' entry, '4' status, '5' eff, '6' term from dual
select utrbank_code, ucbcust_last_name || 
decode(ucbcust_first_name, null , '' , ', ' || 
ucbcust_first_name) || decode(ucbcust_middle_name, null , '' , ' ' || 
ucbcust_middle_name) bank_description from utrbank, ucbcust 
where ucbcust_cust_code = utrbank_cust_code_bank
select utrpycd_code, utrpycd_desc from utrpycd, utvreas where utrpycd_code = utvreas_code 
and utvreas_rsnt_code = 'NUPC' and utrpycd_rev_loc_id = 
(select uzrcloc_rev_loc_id from uzrcloc where uzrcloc_cash_drawer_user_id = 
:key_block.cash_drawer_user_id)
select stvstat_code, stvstat_desc from stvstat order by 1
select utrpycd_code, utrpycd_desc from utrpycd where utrpycd_rev_loc_id = 
(select uzrcloc_rev_loc_id from uzrcloc where uzrcloc_cash_drawer_user_id = :key_block.cash_drawer_user_id)
select utvasvc_code, utvasvc_desc from utvasvc where utvasvc_desc not like 'Elec%' 
order by utvasvc_code

:key is a bind variable - bind variables start with a leading colon. Note the 'select [garbage] from dual' statements. Those do not really impact performance at all. Ignore them. Forms developers do that to avoid having to code fixed data in header for display tables. PS I edited the output a little to be more human readable.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

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

2. Programming

Join 2 SQL queries into one

Dear community, could someone help me to join 2 queries into one? Basically it's the same query with different clauses (please notice the FIELD3 filters and related counters into the subquery): SELECT A.FIELD1,A.FIELD2,A.FIELD3 FROM TABLE A INNER JOIN ( SELECT FIELD1,... (3 Replies)
Discussion started by: Lord Spectre
3 Replies

3. AIX

Convert MS Access Queries to AIX SQL

Unix Team, I'm a recent college graduate entering in the " real world" and boy let me tell you it can quite challenging. I just got a job with a large fortune 50 company lets just say that my expectations and tasks have expanded since I first got hired. Last week I got assigned a pretty big... (9 Replies)
Discussion started by: techstudent01
9 Replies

4. Shell Programming and Scripting

Code needed to get sql queries

Hi i need code to get sql queries through a shell script for a text file input which contain the service ids iputfile I-H-2048-10GB-M I-H-4096-12GB-M I-H-2048-p1000-M the code should contain below queries among which service_id is replacable with value from input file. ... (4 Replies)
Discussion started by: surender reddy
4 Replies

5. UNIX for Advanced & Expert Users

How to i execute .rdf file oracle report automatically in cron tab unix

Hi, I want to execute .rdf file which uses oracle report in crontab ..Can you please help me out how to schedule it crontab.as it is a rdf file Please give any suggestions regarding the above issue. (0 Replies)
Discussion started by: soumyamishra
0 Replies

6. UNIX for Advanced & Expert Users

Extract Oracle DB Connect and SQL execution log

Hi, I am trying to write a generic script as a part of a framework which will establish Oracle DB connection once and loops in to check for some files which gives the SQL statements to execute. The script is running but I am stuck with capturing errors ( ORA and SP) and outputs. Example: ... (4 Replies)
Discussion started by: mirage0809
4 Replies

7. Shell Programming and Scripting

Select SQL Queries Option

count.sh#!/bin/ksh SQL1=`sqlplus -s usr/pwd @count.sql $1 $2 $3` SQL2=`sqlplus -s usr/pwd @selectall.sql $1 $2 $3` LIST="Count Select_All" select i in $LIST do if then echo $SQL1 elif then echo $SQL2 fi done (2 Replies)
Discussion started by: killboy
2 Replies

8. Shell Programming and Scripting

Need to extract .sql files

Hi, I am trying to extract all .sql files present in a particular directory and its sub directories. How can i do this using shell script or awk? any help would be earnestly appreciated. thanks. (1 Reply)
Discussion started by: sprinleo
1 Replies

9. UNIX for Dummies Questions & Answers

shell script for sql queries

Hi All, I have written 4 sql queries . Now I want to write one SHELL SCRIPTING program for all these queries... i.e 1.select * from head; 2. select * from detail; 3. delete from head; 4. delete from detail; Please let me know how to write a shell script... Thank you (1 Reply)
Discussion started by: user71408
1 Replies

10. UNIX for Dummies Questions & Answers

SQL queries in background?

I have to query a DB2 database, and sometimes they take a long time to produce results. Can I run these queries in the background, and if so, where will the results appear? (1 Reply)
Discussion started by: jpprial
1 Replies
Login or Register to Ask a Question