Sponsored Content
Top Forums Shell Programming and Scripting Read Table,View,Package,Function and Procedure Name in a File Post 302458229 by hanu_oracle on Thursday 30th of September 2010 06:12:11 AM
Old 09-30-2010
[/COLOR]
Quote:
Originally Posted by sboss
Hi

I am new to Unix shell scripting. But i need help to slove the below issue.

Issue description:
I want to read table, view names and package names in a file

my plan to find the table name is : search "From" key word find the table or view
To find the packge name : Search "Package body" key word
To Search Function Name: Search "Function"

In a file i have multiple queries like below.

Sample file:

select * from EMP,DEPT
where emp.deptno=dept.deptno

Package Body xxx_Search_PKG

In the above query i want to find the EMP table first display out as below in a file. find DEPT table and put in second line.

Output: Find each table or Function or Package and display out put like below in one file.

<file Name> <0000> <table name/package name/function name> <Report> <APPS>



Thanks in Advance
If u have Database access, you can simply fetch details using:
select OBJECT_NAME, OBJECT_TYPE from dba_objects where OBJECT_TYPE in ('TABLE', 'VIEW', 'PROCEDURE', 'PACKAGE') order by OBJECT_TYPE;

In the Unix every thing is case sensitive,
In sql query you can write the query as "FROM table_name WHERE" or "from table_name where" or "From table_name Where" and so on formats.

Some times you are using the Multiple Object names in the select query with alias names also.

select a.col1, a.col2, b.col1, d.col5 from TABLE1 a, Table2 b, table4 d
where ....

It is some more difficult to fetch the all the object details in the file.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

procedure/function not found in .ksh

Hi all , I am getting an error "job_procfile not found" while excecuting a .ksh script. The script is used to create control-m ( scheduler ) jobs dynamically by reading parameter files ( flat filescomma seperated ) job_procfile is a function within the .ksh script The script is something... (8 Replies)
Discussion started by: rajesh_ramaoz
8 Replies

2. Programming

how to view symbol table in unix

hi , How to view the contents of a "c" program symbol table information in unix. (1 Reply)
Discussion started by: saravanan_nitt
1 Replies

3. Programming

Cannot read a file with read(fd, buffer, buffersize) function

# include <stdio.h> # include <fcntl.h> # include <stdlib.h> # include <sys/stat.h> int main(int argc, char *argv) { int fRead, fPadded, padVal; int btRead; int BUFFSIZE = 512; char buff; if (argc != 4) { printf ("Please provide all of the... (3 Replies)
Discussion started by: naranja18she
3 Replies

4. Shell Programming and Scripting

loading the data to the partitioned table using procedure

Hi one help, I need one procedure to load data from flat file to table. Table name as input parameter for the procedure. can anyone help me Thanks, Raj, (1 Reply)
Discussion started by: easterraj
1 Replies

5. UNIX and Linux Applications

create table via stored procedure (passing the table name to it)

hi there, I am trying to create a stored procedure that i can pass the table name to and it will create a table with that name. but for some reason it creates with what i have defined as the variable name . In the case of the example below it creates a table called 'tname' for example ... (6 Replies)
Discussion started by: rethink
6 Replies

6. Shell Programming and Scripting

Read parameter file in a shell script to unload a DB2 Table???

Hi , I Have following requirement: DB2 Sql query to pass from a parameter file for example, I would create a parameter file with (SELECT column 1, column 2 FROM Table name) then job would read it and create a file with the contents named table.txt How to write/modify below ksh script to... (10 Replies)
Discussion started by: developer.dwh9
10 Replies

7. Shell Programming and Scripting

Table or view is not exist

If I select the statement on db is ok, but same statement on UNIX script I get table or view is not exist. what should I do?:( (5 Replies)
Discussion started by: Hscript
5 Replies

8. UNIX for Beginners Questions & Answers

Improving find to read table name from file

Hi there, I currently use the following find command to recursively search all the subdirectories in our file system for a table ( in this case BB_TENURE_DAYS) find -type f -exec grep -l "BB_TENURE_DAYS" {} \+ So I have this so far - the problem is how do I read the line to get the... (2 Replies)
Discussion started by: rjsha1
2 Replies

9. UNIX for Beginners Questions & Answers

Read Table in file and split

HELLO I need your help please , i need to read a file that contain a table like : Name | Status ------------------ DB 1 | UP DB 2 | UP DB 3 | DOWN DB 4 | UP DB 5 | UP the objective to read each line and check if DB is UP or Down and give me the name of Down database.... (10 Replies)
Discussion started by: Abdellah
10 Replies
PG_SELECT(3)															      PG_SELECT(3)

pg_select - Select records

SYNOPSIS
mixed pg_select (resource $connection, string $table_name, array $assoc_array, [int $options = PGSQL_DML_EXEC]) DESCRIPTION
pg_select(3) selects records specified by assoc_array which has field=>value. For a successful query, it returns an array containing all records and fields that match the condition specified by assoc_array. If options is specified, pg_convert(3) is applied to assoc_array with the specified flags. PARAMETERS
o $connection - PostgreSQL database connection resource. o $table_name - Name of the table from which to select rows. o $assoc_array - An array whose keys are field names in the table $table_name, and whose values are the conditions that a row must meet to be retrieved. o $options - Any number of PGSQL_CONV_FORCE_NULL, PGSQL_DML_NO_CONV, PGSQL_DML_ESCAPE, PGSQL_DML_EXEC, PGSQL_DML_ASYNC or PGSQL_DML_STRING combined. If PGSQL_DML_STRING is part of the $options then query string is returned. When PGSQL_DML_NO_CONV or PGSQL_DML_ESCAPE is set, it does not call pg_convert(3) internally. RETURN VALUES
Returns TRUE on success or FALSE on failure. Returns string if PGSQL_DML_STRING is passed via $options. EXAMPLES
Example #1 pg_select(3) example <?php $db = pg_connect('dbname=foo'); // This is safe, since $_POST is converted automatically $rec = pg_select($db, 'post_log', $_POST); if ($rec) { echo "Records selected "; var_dump($rec); } else { echo "User must have sent wrong inputs "; } ?> CHANGELOG
+-------------+---------------------------------------------------+ | Version | | | | | | | Description | | | | +-------------+---------------------------------------------------+ | 5.6.0 | | | | | | | No longer experimental. Added PGSQL_DML_ESCAPE | | | constant, TRUE/ FALSE and NULL data type support. | | | | |5.5.3/5.4.19 | | | | | | | Direct SQL injection to $table_name and Indirect | | | SQL injection to identifiers are fixed. | | | | +-------------+---------------------------------------------------+ SEE ALSO
pg_convert(3). PHP Documentation Group PG_SELECT(3)
All times are GMT -4. The time now is 11:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy