Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2009
    Posts
    7

    Arrow Unanswered: How to Join the two function

    Hi All,
    I have something like this where i want to concanate two fuction.
    I have created two function SQL () and ORA_CONN() (where SQL Query is there in SQL Function which i want to execute, And ORA_CONN is for oracle connection).

    SQL ()
    {
    echo "set linesize 150"
    echo "set pagesize 100"
    echo "spool table_analyzed_avg_row_lenght.alert"
    echo "select owner||'.'||table_name "Table_Name" ,AVG_ROW_LEN,LAST_ANALYZED from dba_tables where upper(owner) not in ('SYS','SYSTEM','PUBLIC') ORDER BY OWNER;"
    echo "spool off"
    echo "exit"
    }

    ORA_CONN ()
    {
    DBUSER=$1
    DBPASS=$2
    DBSID=$3
    sqlplus -s ${DBUSER}/${DBPASS}\@${DBSID}
    #@$HOME/scripts/Table_Analyzed_Avg_Row_Length.sql > $LOCATION/log/$SID/$LogFileName
    }
    Now i want to run this as ,which will call to run my SQL Query in this ORA_CONN.

    for that my logic is

    for SID in `cat $ORATAB | awk -f\# {print}| cut -d":" -f1`
    VAR=`grep -i $SID $LOCATION/.DBCONFIG.cfg | cut -d"|" -f1`
    USERNAME=`grep -i $SID $LOCATION/.DBCONFIG.cfg | cut -d"|" -f2`
    export USERNAME
    echo $USERNAME
    PASSWORD=`grep -i $SID $LOCATION/.DBCONFIG.cfg | cut -d"|" -f3`
    export PASSWORD
    echo $PASSWORD
    SQL | `ORA_CONN $USERNAME $PASSWORD $SID`


    this is to reteive the username / password from .DBCONFIG.cfg file

    Problem is if i hard codded the username and password and simply use
    SQL | ORA_CONN
    then it works but i dont want to run as hard codded , i want it to retreive the username password from file.

    How to resolve this
    SQL | `ORA_CONN $USERNAME $PASSWORD $SID`


    Thanks in Advance

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by jhonddba
    How to resolve this
    SQL | `ORA_CONN $USERNAME $PASSWORD $SID`
    Can you please explain the purpose of the backquotes in the fragment above?
    ---
    "It does not work" is not a valid problem statement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •