OMB PLUS - Problem passing Unix environment variables to OMBPlus

Due to a requirement to encapsulate deployment of OWB applications, we currently start OMBPlus.sh from our own wrapper ksh script (deploy.ksh) in order to get the new / changed application into the target control center etc.
We now have a new requirement that means we need to pass the content of the Unix environment across to OMBPlus.sh (and from thence into our deployment tcl scripts).
No problem, if you believe the tcl documentation. The entire Unix environement gets dumped into a hash array called 'env', so you can get the variable's value out just by saying $env(unix_valraible).
Sounds great, it should work a treat.
Except OMBPlus only silghtly resembles tclsh.
The 'env' that gets into OMBPlus bears practically no resemblance to the 'env' that existed before OMBPlus.sh got invoked.
Does anyone have:
a decent explanation for why the env gets scrambled (and how to avoid it) ?
or an alternative method of getting the Unix environment varaible values into OMBPlus ?
Please do not propose passing them all on the command line because (would you beleive it) the values are database passwords !
Edited by: user10466244 on 23.10.2008 09:28

Unfortunately, the java implementation of TCL that Oracle used as the basis for OMB+ is NOT a fully-featured implementation. Just try using packages...
However, and understanding why you don't want to hard-code passwords into a file, you can always edit the setowbenv.sh file in your owb/bin/unix directory to grab your specific shell environment variables and propogate them to the java session.
towards the bottom of this env file you will see a section that looks something like:
JDK_HOME=../../../jdk
OWB_HOME=/owb
ORA_HOME=/owb
OEM_HOME=/owb
IAS_HOME=/owb
ORACLE_HOME=/owb
CLASSPATH=Personalties.jar:../admin:$MIMB_JAR:
CLASSPATH_LAUNCHER="-classpath ../admin:../admin/launcher.jar:$CLASSPATH: -DOWB_HOME=$OWB_HOME -DJDK_HOME=$JDK_HOME -DORA_HOME=$ORA_HOME -DOEM_HOME=$OEM_HOME -DIAS_HOME=$IAS_HOME -Doracle.net.tns_admin=$ORA_HOME/network/admin Launcher ../admin/owb.classpath"
export ORA_HOME
export OWB_HOME
export JDK_HOME
export OEM_HOME
export IAS_HOME
export ORACLE_HOME
You could add in the environment variables that you want propogated, include them into the CLASSPATH_LAUNCHER, and then they will turn up in your OMB+ session env array.
e.g., to propgate an environment variable called MY_DATABASE_PASSWORD you would:
JDK_HOME=../../../jdk
OWB_HOME=/owb
ORA_HOME=/owb
OEM_HOME=/owb
IAS_HOME=/owb
ORACLE_HOME=/owb
CLASSPATH=Personalties.jar:../admin:$MIMB_JAR:
CLASSPATH_LAUNCHER="-classpath ../admin:../admin/launcher.jar:$CLASSPATH: -DOWB_HOME=$OWB_HOME -DMY_DATABASE_PASSWORD=${MY_DATABASE_PASSWORD} -DJDK_HOME=$JDK_HOME -DORA_HOME=$ORA_HOME -DOEM_HOME=$OEM_HOME -DIAS_HOME=$IAS_HOME -Doracle.net.tns_admin=$ORA_HOME/network/admin Launcher ../admin/owb.classpath"
export ORA_HOME
export OWB_HOME
export JDK_HOME
export OEM_HOME
export IAS_HOME
export ORACLE_HOME
So now you have no protected data hardcoded, it will pick up your specific environment variables at runtime, and when you start OMB+ you will be able to:
array get env MY_DATABASE_PASSWORD.
cheers,
Mike

Similar Messages

  • How to pass Unix environment variable to a SQL procedure or SQL * Plus

    Can any body suggest me how to ,
    How to pass Unix environment variable to a SQL procedure or SQL * Plus file..
    I am trying to invoke a SQL Procedure from Unix
    by passing the value of a Unix environment variable.
    Is it possible..?
    Thanks in advance.
    Regards,
    Srinivas Jaltaru

    Within your shell script you can use what is known as a "here document" which is basically a way of wrapping a call to Oracle. The following call to Oracle loops and writes rows to files with numerically increasing file names. Two unix shell variables are used, one in a select statement and one in a spool command :
    <pre>
    #!/bin/bash
    export ORACLE_SID=DEV05
    FILENO=1007351
    while [ ${FILENO} -le 1008400 ]
    do
    FILENAME=farm_${FILENO}.txt
    DUMMY=`sqlplus -s user20/user20 <<SQLSTOP
    set lines 73
    set pages 0
    set head off
    set termout off
    set echo off
    set feedback off
    select rpad(searchx, 8)
    from blastx@PRODUCTION
    where searchx = ${FILENO} ### here's a shell variable
    spool /export/home/user20/sql/psiblast/BACKUP2_D/${FILENAME} ### here's a shell variable
    spool off
    SQLSTOP`
    FILENO=`expr ${FILENO} + 1`
    done
    exit 0
    </pre>

  • Accessing shell environment variables inside OMBPlus script

    Hi,
    I have a problem accessing an environment variable inside OMBPlus script. I can 'see' the env. var values when using tclsh, but when I use OMBPlus.sh it doesn't work?
    Anybody has an example of how to do this?
    For example: puts $::env(MYVAR)
    Thanks,
    Ed

    Hello!
    Issue the command:
    puts [array names env];
    this will print you the content of the env array which is definitely not the environment variables.
    If you want your environment variable appear in the env tcl variable then you must edit the ombplus.bat file and pass it through a java option like this:
    -DMYENV="%MYENV%" (on windows assuming you declared MYENV).
    Now puts $env(MYENV) will work.
    Regards,
    Robert

  • Fetching UNIX environment variables

    Does anyone know of a way to fetch a UNIX environment variable into a PL/SQL variable?
    Thanks
    Kerri

    Hi Dave
    If you are just running through the conc manager as a regular report you can not do this. At the CM layer publisher is not aware of nor can it be passed environment variables.
    If you are on 11.5 why not store the sub template in the template manager and then use our URI to reference it:
    xdo://APPCODE.TEMPLCODE.LANG.TERR
    Check the user guide.
    Regards
    Tim

  • XSL variable and unix environment variable

    Any idea how I can pass the unix environment variable to the custom XSL file? I want to be able to pass the $PO_TOP path so the file location can be derived
    The below code works fine for static file location but I want it to be more generic.
    <fo:block xsl:use-attribute-sets="termcond">
    <xsl:if test="($print_draft = '')">
         <xsl:value-of select="unparsed-text('/usr/tmp/tc.txt','UTF-8')"/>
    </xsl:if>
    </fo:block>
    <fo:block id="last-page"/>
    Thanks in advance

    you'll need to use the name(.) XPath function to test the name of the current node.

  • How do I use a UNIX environment variable for the path of a file name

    We are running Forms 6i over the web. The forms server runs on a UNIX (HP-UX) machine.
    I want to read the contents of a file, which is simple enough, using the TEXT_IO package. However, I want to reference a UNIX environment variable that specifies the file path i.e
    PROCEDURE get_file IS
    in_file Text_IO.File_Type;
    linebuf VARCHAR2(1800);
    filename VARCHAR2(200);
    BEGIN
    filename:= '$LOG_DIR/RCAS181.log';
    in_file := Text_IO.Fopen(filename, 'r');
    .....other stuff
    Notice the filename string references my unix env variable '$LOG_DIR'. However, this doesnt work. If I put the full pathname it works fine.
    Any suggestions ?

    Have a look at TOOL_ENV.GETVAR()

  • Java and UNIX environment variables

    Hi folks,
    am I right when I say that it is not possible to access UNIX environment variables from Java (these ones delared by the export statement)?
    Cheers,
    Heiko

    Yes.. Since some OS do not have the  concept of environment variables,it is directly not possible.
    But using the method System.getProperties you can get
    some inf about the environment.
    the following links may be of some help to you
    http://www.javaworld.com/javaworld/javaqa/2001-07/01-qa-0706-env.html
    http://www.jguru.com/faq/view.jsp?EID=11422

  • Unix Environment variable for connect string in SQL*Plus

    I am using some environment variables to connect to a sql*plus session in unix.
    they are exported as part of a file which contains the following and gets executed through the .profile.
    export db_username=xxx
    export db_password=xxx
    export db_name=xxx
    i have created a file abc.sql which contains the following
    connect $db_username/$db_password@$db_name
    Now, I have a shell script which uses this file inside it to connect to a sql*plus session and execute some queries.
    The contents of the shell script :
    API_CONNECT_SQL=abc.sql
    sqlplus /nolog << THEEND
    WHENEVER SQLERROR EXIT SQL.SQLCODE ROLLBACK
    WHENEVER OSERROR EXIT FAILURE ROLLBACK
    set timing on
    @${API_CONNECT_SQL}
    ---- do something
    EXIT
    THEEND
    Now, the sql*plus session is able to get db_username and db_password, but not the db_name. It says "TNS service name not found".
    If I hardcode some database name in place of db_name, it connects properly.
    Please let me know the problem and solution as well.
    Any help appreciated.
    thanks,
    Vijay

    for me this one works
    # =========================================
    # begin of script
    # =========================================
    export db_username=alpha
    export db_password=bravo
    export db_name=charly
    echo "connect $db_username/$db_password@$db_name" > xxx.sql
    API_CONNECT_SQL=/cfs/dummy1/0/appl/dummy2/rev_04/zzz/tst/xxx.sql
    cat ${API_CONNECT_SQL}
    sqlplus /nolog << THEEND
    spool xxx
    WHENEVER SQLERROR EXIT SQL.SQLCODE ROLLBACK
    WHENEVER OSERROR EXIT FAILURE ROLLBACK
    set echo on
    host cat ${API_CONNECT_SQL}
    @${API_CONNECT_SQL}
    select * from dual;
    spool off
    EXIT
    THEEND
    # =========================================
    # end of script
    # =========================================

  • Unix Environment Variables

    I use EBS 11.5 and I am trying to use XML Publisher with RTF files for PO printing. I have a main script loaded into Oracle as the template and it uses
    <?import:file///home/dave/scripts/test.rtf?> to pull in a subtemplate. I want to change this to reference an environment variable, like MY_HOME, instead of having the directory hardcoded into the import statement.
    Home do I do that?
    What is the syntax in the import statement?

    Hi Dave
    If you are just running through the conc manager as a regular report you can not do this. At the CM layer publisher is not aware of nor can it be passed environment variables.
    If you are on 11.5 why not store the sub template in the template manager and then use our URI to reference it:
    xdo://APPCODE.TEMPLCODE.LANG.TERR
    Check the user guide.
    Regards
    Tim

  • Getting a Unix environment variable

    Hi, everyone.
    I need to use a Unix enviroment variable from a form. This form
    is gonna use this variable in order to be the path of another
    form who is gonna be called.
    In other words:
    CALL_FORM( $unix_var + '/forms/myform_name' );
    unix_var is what I want to get.
    Thanks a lot in advance,
    Eduardo

    It worked, Michael. Thanks a lot!
    To the documentation guys at Oracle... This is how you define
    the TOOL_ENV package in the Forms' help:
    "The TOOL_ENV package allows you to interact with Oracle
    environment variables by retrieving their values for use in
    subprograms."
    Suggestion: ...with Oracle environment variables AND OTHER
    SYSTEM OPERATION ENVIRONMENT VARIABLES...
    because this narrow definition can prevent people for trying to
    use it to retrieve other NON-ORACLE environment variable via
    this package. Thanks.

  • Changing UNIX environment variables?

    Is there an easy way to change the environment from inside Java-code?
    I have tried using the compile version and this works fine.
    Compile version:
    java -DmyVar="$PATH" myClass
    and then used System.setProperty("myVar", "/home/lala");
    The above works fine and changes the PATH variable in UNIX, but i don�t want to set these things at compiletime, is there another way?
    Thank you for any hints
    // adde

    I want to change the systems environment variable when I run my Java application, what happens when I close the program does not concern me. And I don�t just want to fetch what�s currently there, I want to change them and then use them in my program.
    But can you somehow do this without telling the program what variables you are interested in at compile time?
    Thank you for your answers

  • Problem with my environment variable

    hello,
    I've set the following environment variables in Windows XP professional:
    JEE_HOME = C:\j2sdkee1.3.1
    JAVA_HOME = C:\j2sdk1.4.2_05
    PATH = ....... ;C:\j2sdkee1.3.1\bin
    When I wanted to run the J2EE server, I've got the following:
    C:\>j2ee
    Exception in thread "main" java.lang.NoClassDefFoundError: C:\j2sdkee1/3/1;C:\j2sdk1/4/2_05\lib\tools/jar;C:\j2sdkee1/3/1\lib\jhall/jar
    The "." changed in a "/"!
    Does somebody know how I can solve this problem?
    Thanks!

    So,
    I have in System PATH : C:\app\xps\product\11.2.0\dbhome_1\bin
    I have in HKEY_LOCAL_MACHINE > SOFTWARE > ORACLE > SYSMAN > OracleDBConsoleorcl : ORACLE_HOME value C:\app\xps\product\11.2.0\dbhome_1
    When i execute sqlplus / as sysdba comman, i receive error "the procedure entry point longjmp could not be found in the dynamic link lib. orauts.dll" and Error "ORA-12560"
    If i execute
    set ORACLE_HOME=C:\app\xps\product\11.2.0\dbhome_1
    C:\>set PATH=%ORACLE_HOME%\bin;%PATH%
    sqlplus "/ as sysdba"
    I don't receive Error.
    Why?

  • Problem passing dynamically created variables

    Hi,
    I have a procedure in which i am creating an object dynamically and i am using that object in another package . I am calling first the procedure that creating the object and recompiling the package and calling to that package but i want to integrate them and instead of calling them individually want to call a single procedure to achieve the requirement . Here i am giving the details of the procedure and package please guide me ..
    CREATE TABLE ip_lov_hdr
    (table_id VARCHAR2(50) NOT NULL,
    table_name VARCHAR2(30) NOT NULL,
    col_name VARCHAR2(30) NOT NULL,
    codetype VARCHAR2(2))
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    ALTER TABLE ip_lov_hdr
    ADD CONSTRAINT pk_lov_hdr PRIMARY KEY (table_id)
    USING INDEX
    PCTFREE 10
    INITRANS 2
    MAXTRANS 255
    CREATE TABLE ip_lov_dtl
    (table_id VARCHAR2(50) NOT NULL,
    col_name VARCHAR2(30) NOT NULL)
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    ALTER TABLE ip_lov_dtl
    ADD CONSTRAINT pk_lov_dtl PRIMARY KEY (table_id, col_name)
    USING INDEX
    PCTFREE 10
    INITRANS 2
    MAXTRANS 255
    ALTER TABLE ip_lov_dtl
    ADD CONSTRAINT fk_lov_hdr FOREIGN KEY (table_id)
    REFERENCES ip_lov_hdr (table_id) ON DELETE SET NULL
    CREATE TABLE emp
    (ename VARCHAR2(50),
    empno VARCHAR2(9),
    dept VARCHAR2(4))
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    CREATE OR REPLACE
    TYPE out_rec_lov AS OBJECT(ename VARCHAR2(50),empno VARCHAR2(9))
    INSERT INTO emp
    (ENAME,EMPNO,DEPT)
    VALUES
    ('titu','111','10')
    INSERT INTO emp
    (ENAME,EMPNO,DEPT)
    VALUES
    ('naria','222',NULL)
    INSERT INTO emp
    (ENAME,EMPNO,DEPT)
    VALUES
    ('tiks','123','55')
    INSERT INTO emp
    (ENAME,EMPNO,DEPT)
    VALUES
    ('tiki','221',NULL)
    INSERT INTO emp
    (ENAME,EMPNO,DEPT)
    VALUES
    ('narayan',NULL,NULL)
    INSERT INTO ip_lov_hdr
    (TABLE_ID,TABLE_NAME,COL_NAME,CODETYPE)
    VALUES
    ('emp_id','emp','ename',NULL)
    INSERT INTO ip_lov_dtl
    (TABLE_ID,COL_NAME)
    VALUES
    ('emp_id','empno')
    CREATE OR REPLACE
    TYPE out_rec_lov AS OBJECT(ename VARCHAR2(50),empno VARCHAR2(9))
    CREATE OR REPLACE
    PROCEDURE p_recordtypevariable (tab_id IN VARCHAR2,err_msg OUT VARCHAR2)
       IS
          sqlstmt             VARCHAR2 (2000);
          col_str             VARCHAR2 (2000);
          i                   NUMBER := 0;
          l_table_name        ip_lov_hdr.table_name%TYPE;
          l_col_name          ip_lov_hdr.col_name%TYPE;
          l_codetype          ip_lov_hdr.codetype%TYPE;
          l_datatype          VARCHAR2 (100);
          invalid_tableid     EXCEPTION;
       BEGIN
          BEGIN
             SELECT a.table_name,
                    a.codetype,
                    a.col_name,
                    b.data_type || '(' || b.data_length || ')'
               INTO l_table_name,
                    l_codetype,
                    l_col_name,
                    l_datatype
               FROM ip_lov_hdr a, user_tab_columns b
              WHERE UPPER (a.table_id) = UPPER (tab_id)
                AND UPPER (a.table_name) = UPPER (b.table_name)
                AND UPPER (a.col_name) = UPPER (b.column_name);
          EXCEPTION
             WHEN NO_DATA_FOUND THEN
                RAISE invalid_tableid;
          END;
          col_str := l_col_name || ' ' || l_datatype;
          FOR rec IN  (SELECT b.col_name,
                              c.data_type || '(' || c.data_length || ')' datatype
                         FROM ip_lov_hdr a, ip_lov_dtl b, user_tab_columns c
                        WHERE UPPER (b.table_id) = UPPER (tab_id)
                          AND UPPER (a.table_id) = UPPER (b.table_id)
                          AND UPPER (a.table_name) = UPPER (c.table_name)
                          AND UPPER (b.col_name) = UPPER (c.column_name) )
          LOOP
             col_str := col_str || ',' || rec.col_name || ' ' || rec.datatype;
          END LOOP;
          sqlstmt := 'CREATE OR REPLACE TYPE out_rec_lov AS OBJECT(' || col_str || ')';
          dbms_utility.exec_ddl_statement(sqlstmt);
          dbms_utility.exec_ddl_statement('alter package pkg_lov_new compile');
       EXCEPTION
          WHEN invalid_tableid THEN
             err_msg := 'Table is not defined ';
          WHEN OTHERS THEN
             err_msg := SUBSTR (SQLERRM, 1, 500);
       END p_recordtypevariable;
    CREATE OR REPLACE
    PACKAGE pkg_lov_new
    AS
    TYPE listtable IS TABLE OF out_rec_lov index by binary_integer;
    PROCEDURE p_getlov (
    tab_id IN VARCHAR2,
    col_value IN VARCHAR2,
    outlist OUT listtable,
    err_msg OUT VARCHAR2);
    END;
    CREATE OR REPLACE
    PACKAGE BODY pkg_lov_new
    AS
      PROCEDURE p_getlov (
          tab_id                     IN VARCHAR2,
          col_value                  IN VARCHAR2,
          outlist                    OUT listtable,
          err_msg                    OUT VARCHAR2)
       IS
          query_str           VARCHAR2 (2000);
          col_str             VARCHAR2 (2000);
          TYPE cur_typ IS REF CURSOR;
          c                   cur_typ;
          i                   NUMBER := 0;
          l_table_name        ip_lov_hdr.table_name%TYPE;
          l_col_name          ip_lov_hdr.col_name%TYPE;
          l_codetype          ip_lov_hdr.codetype%TYPE;
       BEGIN
          BEGIN
             SELECT table_name,
                    codetype,
                    col_name
               INTO l_table_name,
                    l_codetype,
                    l_col_name
               FROM ip_lov_hdr
              WHERE UPPER (table_id) = UPPER (tab_id);
          EXCEPTION
             WHEN NO_DATA_FOUND THEN
                NULL;
          END;
          col_str := l_col_name;
          FOR rec IN  (SELECT col_name
                         FROM ip_lov_dtl
                        WHERE table_id = tab_id)
          LOOP
             col_str := col_str || ',' || rec.col_name;
          END LOOP;
          IF l_codetype IS NULL THEN
             query_str :=    'select out_rec_lov('
                          || col_str
                          || ') from '
                          || l_table_name
                          || ' where '
                          || l_col_name
                          || ' like :col_value';
             BEGIN
                OPEN c FOR query_str USING col_value;
                LOOP
                   FETCH c INTO outlist (i);
                   i := i + 1;
                   EXIT WHEN c%NOTFOUND;
                END LOOP;
                CLOSE c;
             EXCEPTION
                WHEN OTHERS THEN
                   err_msg := SUBSTR (SQLERRM, 1, 500);
             END;
          ELSE
             query_str :=    'select out_rec_lov('
                          || col_str
                          || ') from '
                          || l_table_name
                          || ' where code_type =:l_codetype and '
                          || l_col_name
                          || ' like :col_value';
             BEGIN
                OPEN c FOR query_str USING l_codetype, col_value;
                LOOP
                   FETCH c INTO outlist (i);
                   i := i + 1;
                   EXIT WHEN c%NOTFOUND;
                END LOOP;
                CLOSE c;
             EXCEPTION
                WHEN OTHERS THEN
                   err_msg := SUBSTR (SQLERRM, 1, 500);
             END;
          END IF;
       EXCEPTION
          WHEN OTHERS THEN
             err_msg := SUBSTR (SQLERRM, 1, 500);
       END p_getlov;
    END pkg_lov_new;
    /Regards,
    Dhabas
    Edited by: Dhabas on Dec 30, 2008 5:52 PM

    CREATE TABLE ip_lov_hdr
    (table_id VARCHAR2(50) NOT NULL,
    table_name VARCHAR2(30) NOT NULL,
    col_name VARCHAR2(30) NOT NULL,
    codetype VARCHAR2(2))
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    ALTER TABLE ip_lov_hdr
    ADD CONSTRAINT pk_lov_hdr PRIMARY KEY (table_id)
    USING INDEX
    PCTFREE 10
    INITRANS 2
    MAXTRANS 255
    CREATE TABLE ip_lov_dtl
    (table_id VARCHAR2(50) NOT NULL,
    col_name VARCHAR2(30) NOT NULL)
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    ALTER TABLE ip_lov_dtl
    ADD CONSTRAINT pk_lov_dtl PRIMARY KEY (table_id, col_name)
    USING INDEX
    PCTFREE 10
    INITRANS 2
    MAXTRANS 255
    ALTER TABLE ip_lov_dtl
    ADD CONSTRAINT fk_lov_hdr FOREIGN KEY (table_id)
    REFERENCES ip_lov_hdr (table_id) ON DELETE SET NULL
    CREATE TABLE emp
    (ename VARCHAR2(50),
    empno VARCHAR2(9),
    dept VARCHAR2(4))
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    CREATE OR REPLACE
    TYPE out_rec_lov AS OBJECT(ename VARCHAR2(50),empno VARCHAR2(9))
    INSERT INTO emp
    (ENAME,EMPNO,DEPT)
    VALUES
    ('titu','111','10')
    INSERT INTO emp
    (ENAME,EMPNO,DEPT)
    VALUES
    ('naria','222',NULL)
    INSERT INTO emp
    (ENAME,EMPNO,DEPT)
    VALUES
    ('tiks','123','55')
    INSERT INTO emp
    (ENAME,EMPNO,DEPT)
    VALUES
    ('tiki','221',NULL)
    INSERT INTO emp
    (ENAME,EMPNO,DEPT)
    VALUES
    ('narayan',NULL,NULL)
    INSERT INTO ip_lov_hdr
    (TABLE_ID,TABLE_NAME,COL_NAME,CODETYPE)
    VALUES
    ('emp_id','emp','ename',NULL)
    INSERT INTO ip_lov_dtl
    (TABLE_ID,COL_NAME)
    VALUES
    ('emp_id','empno')
    CREATE OR REPLACE
    TYPE out_rec_lov AS OBJECT(ename VARCHAR2(50),empno VARCHAR2(9))
    CREATE OR REPLACE
    PROCEDURE p_recordtypevariable (tab_id IN VARCHAR2,err_msg OUT VARCHAR2)
    IS
    sqlstmt VARCHAR2 (2000);
    col_str VARCHAR2 (2000);
    i NUMBER := 0;
    l_table_name ip_lov_hdr.table_name%TYPE;
    l_col_name ip_lov_hdr.col_name%TYPE;
    l_codetype ip_lov_hdr.codetype%TYPE;
    l_datatype VARCHAR2 (100);
    invalid_tableid EXCEPTION;
    BEGIN
    BEGIN
    SELECT a.table_name,
    a.codetype,
    a.col_name,
    b.data_type || '(' || b.data_length || ')'
    INTO l_table_name,
    l_codetype,
    l_col_name,
    l_datatype
    FROM ip_lov_hdr a, user_tab_columns b
    WHERE UPPER (a.table_id) = UPPER (tab_id)
    AND UPPER (a.table_name) = UPPER (b.table_name)
    AND UPPER (a.col_name) = UPPER (b.column_name);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    RAISE invalid_tableid;
    END;
    col_str := l_col_name || ' ' || l_datatype;
    FOR rec IN (SELECT b.col_name,
    c.data_type || '(' || c.data_length || ')' datatype
    FROM ip_lov_hdr a, ip_lov_dtl b, user_tab_columns c
    WHERE UPPER (b.table_id) = UPPER (tab_id)
    AND UPPER (a.table_id) = UPPER (b.table_id)
    AND UPPER (a.table_name) = UPPER (c.table_name)
    AND UPPER (b.col_name) = UPPER (c.column_name) )
    LOOP
    col_str := col_str || ',' || rec.col_name || ' ' || rec.datatype;
    END LOOP;
    sqlstmt := 'CREATE OR REPLACE TYPE out_rec_lov AS OBJECT(' || col_str || ')';
    dbms_utility.exec_ddl_statement(sqlstmt);
    dbms_utility.exec_ddl_statement('alter package pkg_lov_new compile');
    EXCEPTION
    WHEN invalid_tableid THEN
    err_msg := 'Table is not defined ';
    WHEN OTHERS THEN
    err_msg := SUBSTR (SQLERRM, 1, 500);
    END p_recordtypevariable;
    CREATE OR REPLACE
    PACKAGE pkg_lov_new
    AS
    TYPE listtable IS TABLE OF out_rec_lov index by binary_integer;
    PROCEDURE p_getlov (
    tab_id IN VARCHAR2,
    col_value IN VARCHAR2,
    outlist OUT listtable,
    err_msg OUT VARCHAR2);
    END;
    CREATE OR REPLACE
    PACKAGE BODY pkg_lov_new
    AS
    PROCEDURE p_getlov (
    tab_id IN VARCHAR2,
    col_value IN VARCHAR2,
    outlist OUT listtable,
    err_msg OUT VARCHAR2)
    IS
    query_str VARCHAR2 (2000);
    col_str VARCHAR2 (2000);
    TYPE cur_typ IS REF CURSOR;
    c cur_typ;
    i NUMBER := 0;
    l_table_name ip_lov_hdr.table_name%TYPE;
    l_col_name ip_lov_hdr.col_name%TYPE;
    l_codetype ip_lov_hdr.codetype%TYPE;
    BEGIN
    BEGIN
    SELECT table_name,
    codetype,
    col_name
    INTO l_table_name,
    l_codetype,
    l_col_name
    FROM ip_lov_hdr
    WHERE UPPER (table_id) = UPPER (tab_id);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    END;
    col_str := l_col_name;
    FOR rec IN (SELECT col_name
    FROM ip_lov_dtl
    WHERE table_id = tab_id)
    LOOP
    col_str := col_str || ',' || rec.col_name;
    END LOOP;
    IF l_codetype IS NULL THEN
    query_str := 'select out_rec_lov('
    || col_str
    || ') from '
    || l_table_name
    || ' where '
    || l_col_name
    || ' like :col_value';
    BEGIN
    OPEN c FOR query_str USING col_value;
    LOOP
    FETCH c INTO outlist (i);
    i := i + 1;
    EXIT WHEN c%NOTFOUND;
    END LOOP;
    CLOSE c;
    EXCEPTION
    WHEN OTHERS THEN
    err_msg := SUBSTR (SQLERRM, 1, 500);
    END;
    ELSE
    query_str := 'select out_rec_lov('
    || col_str
    || ') from '
    || l_table_name
    || ' where code_type =:l_codetype and '
    || l_col_name
    || ' like :col_value';
    BEGIN
    OPEN c FOR query_str USING l_codetype, col_value;
    LOOP
    FETCH c INTO outlist (i);
    i := i + 1;
    EXIT WHEN c%NOTFOUND;
    END LOOP;
    CLOSE c;
    EXCEPTION
    WHEN OTHERS THEN
    err_msg := SUBSTR (SQLERRM, 1, 500);
    END;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    err_msg := SUBSTR (SQLERRM, 1, 500);
    END p_getlov;
    END pkg_lov_new;
    /

  • Environment variable PATH and Sql*Plus

    Hi all,
    i have a problem with sqlplus.
    It might seem not to be able to read the path environment variable.
    I need to launch some sqls without typing their path (to put the path i should modify morre than 300 shell scripts), e.g.: @script.sql.
    My shell scripts are invoked by the database using java.
    Inside the shell scripts we have commands like "sqlplus -silent <login> @script.sql [parameters]"
    So if sqlplus is not able to read the PATH environment variable, the command hangs waiting for something to do without the chance to close it.(it is silent).
    I run RDBMS v8.1.7 on compaq tru64 Unix.
    Can someone help me??
    Thanks in advance.
    Marco - Milan, Italy

    Where do I set SQL*Plus SQLPATH variable??As every other unix environment variable - either in your profile or in your current shell whatever you like
    Is this the PATH where SQL*Plus searches for .sql
    files??SQL*Plus searches for your files in your current directory, and then the directories you specify with the SQLPATH environment variable.
    SQL*Plus searches this colon-separated list of directories in the order they are listed.

  • [SOLVED] Pass Environment variables from PKGBUILD to .INSTALL script

    Hi everyone,
                       I am trying to modify the grub2-efi-bzr (http://aur.archlinux.org/packages.php?ID=38369) package making some changes in the PKGBUILD and the post-install script. I want to pass few environment variables from the PKGBUILD to the install script. How do I do that?
    Some code from the PKGBUILD
    _bzrtrunk="lp:grub/grub2" # GRUB2 BZR Main Trunk
    # _bzrtrunk="lp:~skodabenz/grub/grub2-bzr-exp" # GRUB2 BZR Experimental Branch
    _bzrmod="grub2"
    if [ ${_bzrtrunk} = "lp:~skodabenz/grub/grub2-bzr-exp" ]
    then
    _bzrmod="grub2_exp"
    pkgver="exp_${pkgver}"
    fi
    # grub-extras bzr repo locations
    _bzrtrunk_zfs="lp:~skodabenz/grub/grub2-extras-zfs"
    _bzrtrunk_lua="lp:~skodabenz/grub/grub2-extras-lua"
    if [ "$CARCH" = 'i686' ]
    then
    _EFI_ARCH=i386
    elif [ "$CARCH" = 'x86_64' ]
    then
    _EFI_ARCH=x86_64
    fi
    # _EFI_ARCH=x86_64 # Uncomment if you want to override the if condition for _EFI_ARCH above, incase the EFI ARCH does not match the Linux Kernel ARCH.
    # $CARCH=x86_64 and _EFI_ARCH=i386 requires gcc-multilib with lib32-glibc installed in the system.
    # I do not know about $CARCH=i686 and _EFI_ARCH=x86_64
    if [ ${_EFI_ARCH} = "i386" ]
    then
    pkgver="${pkgver}_x86"
    _trns_name="grub2_efi_x86"
    elif [ ${_EFI_ARCH} = "x86_64" ]
    then
    pkgver="${pkgver}_x64"
    _trns_name="grub2_efi_x64"
    fi
    Now the post-install script needs the values of _EFI_ARCH and _trns_name env variables. I do not want to copy the if statements to that script as these are decided at compile time but needed while setting up grub2-efi. This is due to the fact that EFI-ARCH need not match the Linux Kernel ARCH. How do I do that.
    Code from the post-install script
    ${_trns_name}-install --root-directory=/ --no-floppy --recheck --debug
    cp /usr/lib/${_trns_name}/${_EFI_ARCH}-efi/lua.mod /boot/${_trns_name}/
    cp /usr/lib/${_trns_name}/${_EFI_ARCH}-efi/zfs.mod /boot/${_trns_name}/
    cp /usr/lib/${_trns_name}/${_EFI_ARCH}-efi/zfsinfo.mod /boot/${_trns_name}/
    cp /usr/lib/${_trns_name}/${_EFI_ARCH}-efi/unifont.pf2 /boot/${_trns_name}/
    cp /usr/lib/${_trns_name}/${_EFI_ARCH}-efi/ascii.pf2 /boot/${_trns_name}/
    ${_trns_name}-mkimage --verbose --directory=/usr/lib/${_trns_name}/${_EFI_ARCH}-efi --prefix="" --output=/boot/${_trns_name}/grub2.efi --format=${_EFI_ARCH}-efi ${_EFI_APP_MODULES}
    Thank in advance.
    Last edited by skodabenz (2010-07-27 15:46:40)

    falconindy wrote:
    Don't rely on %foo% existing -- it won't after the first build and this will prevent the PKGBUILD from being reentrant. I would use something like this (untested):
    sed -i "s|^\(_EFI_ARCH\)=.*|\1=${_EFI_ARCH}|; \
    s|^\(_trns_name\)=.*|\1=${_trns_name}|; \
    s|^\(export _EFI_APP_MODULES\)=.*|\1=${_EFI_APP_MODULES}|" \
    ${startdir}/grub2-efi-bzr.install
    Your code works except for 1 problem in the install script I want
    export __EFI_APP_MODULES="${_EFI_APP_MODULES}" (the passed ${_EFI_APP_MODULES} value should again come inside double quotes).
    right now
    export _EFI_APP_MODULES=ata part_gpt part_msdos fat ntfs ntfscomp ext2 iso9660 udf hfsplus fshelp normal chain linux ls search search_fs_file search_fs_uuid search_label help loopback boot configfile echo efi_gop efi_uga xnu xnu_uuid lvm
    which is equivalent to
    export _EFI_APP_MODULES=ata
    I want
    export _EFI_APP_MODULES="ata part_gpt part_msdos fat ntfs ntfscomp ext2 iso9660 udf hfsplus fshelp normal chain linux ls search search_fs_file search_fs_uuid search_label help loopback boot configfile echo efi_gop efi_uga xnu xnu_uuid lvm"
    How to do it with sed since sed already uses double quotes?

Maybe you are looking for

  • How do I use my USB webcam with Yosemite?

    Since upgrading to OS 10.10, my Mac Pro no longer recognizes my Gear Head USB webcam. Any suggestions?

  • Need information on oApplicationSettings in Fiori applications

    Hi Experts, Need help in understanding the parameter sap.ca.common.uilib.bootstrap.applicationSettings Where is this defined and what all can be configured using this? Thanks and Regards Puneet Jagdev

  • Extracting dmp files

    - I want to extract my dmp files in the windows based information, how it can be done??? - Secondly, i also want to extract my dmp file in the unix based environment. For this extraction, what should i do?? Plz anyone help. Regards Salman

  • Need Help With AMD Radeon HD 8750M + HD 8000 Series Dual Graphics

    I recently purchased the ENVY 15z-j000 and upgraded it with the  AMD Radeon HD 8750M + HD 8000 Series Dual Graphics. I wanted the dedicated HD 8750M for playing games and whatnot. When I first opend up my new laptop, I performed a clean install of Wi

  • Canon printer problem - no preferences, unlike in Windows.

    I have just bought my first mac. The iMac. I had a Windows XP PC which I ran Adobe CS2 and AutoCAD on mainly. Now, when I try to print any of my work I cannot choose any preferences other than the normal page setup basic stuff. On Windows I was able