Apache Environment Variables inside PL/SQL

How to access Apache Environment Variables inside HTMLDB (PL/SQL block)?

Hi,
You can use the owa_util.get_cgi_env packaged function -
FUNCTION GET_CGI_ENV RETURNS VARCHAR2
Argument Name                  Type                    In/Out Default?
PARAM_NAME                     VARCHAR2                INSo, pass in the name of the Env var you want and it will give you back the value.

Similar Messages

  • Can i use a environment variable inside a *.sql file?

    Hello,
    I want to create a external table.
    So i am using the command
    create or replace directory abc as 'C:\folder'.... inside a sql file.
    Now i want the path "C:\folder" to be dynamic as i am using this path in many other places also inside the sql file.So i thought to create a environment variable and put this value there.I tried using as %PATH% but it gives error..... where %PATH%=C:\folder.
    Can i use a environment variable inside a *.sql file?
    But how to do that or is there any other way.
    Thanks
    Swapna
    Edited by: user11018268 on Feb 19, 2010 1:03 AM

    user11018268 wrote:
    Actually what i want is the path "C:\folder" is not fixed it can be anything which i may not know the user may decide it later. Not supported. A directory object refers to a specific physical location (directory/folder) on a file system. Not a path.
    You can work around it by (creating and) using a function (running under a super user schema with authid definer privs). The caller (e.g. schema scott ) calls it with a physical path. E.g. GetDirectoryObject( 'C:\folder\2010\feb\week4' ).
    This function determines if there is an existing directory object for the path. If not, it uses a wildcard search to determine if there are any directory objects for parents in the path (e.g. for C:\folder\2010\feb or C:\folder\2010 or C:\folder ).
    If it finds a directory object, it interrogates the data dictionary to determine if the caller, schema scott for example, has read/write access on that directory object. If it has, it creates a new directory object and grants the caller read/write access to it. The function then returns the name of the directory object to the caller.
    The caller thus do not deal directly with directory objects. The function returns the object name given a physical path as input. Also, only a single base directory needs to be created (e.g. for C:\folder ) and access granted to the schema on it. Any sub-directory in that base directory can now be dynamically accessed by the schema.

  • Error Setting Environment Variable inside Listner.ora

    Hi,
    I am trying to set an environment variable inside listner.ora as follows
    (ENVS="EXTPROC_DLLS=ANY,LD_LIBRARY_PATH=/opt/app/oracle/product/9.2/lib32:/opt/app/oracle/product/9.2/network/lib32:/usr/lib:/usr/X11R6:/usr/dt/lib,LIBPATH=/opt/app/oracle/product/9.2/lib32,MQSERVER=SYSTEM.DEF.SVRCONN/TCP/ashsou03.mcilink.com(4444)")
    but every time I try to start the listner it gives me the following error:
    TNS-01155: Incorrectly specified SID_LIST_LISTENER parameter in LISTENER.ORA
    NL-00303: syntax error in NV string
    I think that the parenthses, (4444), in the MQSERVER value is causing this. Any ideas on how I can configure it?

    Hi
    Very many thanks for ur solution.. i actually hadset the environment variables spacce..but when i execute the autoexec.bat file i dont get any error(out of env space)..but when i run the startup.bat file i get from the command prompt, i get the foll error.
    This is my Autoexec.bat
    SET JAVA_HOME=D:\Jkit\bin
    SET CATALINA_HOME=D:\tomcat\jakarta-tomcat-4.1.29\bin
    SET PATH=D:\Jkit\bin;C:\WINDOWS;C:\WINDOWS\COMMAND;
    SET PATH=%PATH%;C:\PROGRA~1\COMMON~1\AUTODE~1;
    THE FOLLOWING IS THE ERROR I GET WHEN I RUN STARTUP.BAT UNDER TOMCAT'S BIN UNDER THE COMMAND PROMPT
    D:\tomcat\jakarta-tomcat-4.1.29\bin>startup
    Syntax error
    Out of environment space
    Out of environment space
    Out of environment space
    Using CATALINA_BASE: D:\tomcat\jakarta-tomcat-4.1.29
    Using CATALINA_HOME: D:\tomcat\jakarta-tomcat-4.1.29
    Using CATALINA_TMPDIR: D:\tomcat\jakarta-tomcat-4.1.29\temp
    Using JAVA_HOME: D:\Jkit
    Out of environment space
    Out of environment space
    Invalid switch - -DJAVA.ENDORSED.DIRS=D:\TOMCAT\JAKARTA-TOMCAT-4.1.29\COMMON\ENDORSED
    I even set JAVA_HOME AND CATALINE_HOME to the \bin dir respectively..
    still i get the same error
    As given under the tomcat installation documentation (RUNNING.txt), i set the space for environment space under the Memory tab, for startup and shutdown.bat files, it creates a shortcut for running the resp .bat files, running startup.bat file i get,CATALINA_HOME VAR HAS NOT BEEN SET PROPERLY, THIS OCCURS FOR BOTH TOP LEVEL DIR SETTING AND /bin DIR SETTING of CATALINE_HOME IN autoexec.bat
    PLEASE HEL, I HAVE BEEN TRYING TO CONFIGURE IT FOR THE PAST DAYS BUT WITH NO SUCCESS, DONT KNOW WHERE I AM GOING WRONG..PLEASE HELP

  • Apache Environment variables usage for dispatcher configurations

    I have tried using apache environment variables within dispatcher.any files which doesn't seem to work. Is it feasible?

    Hi Yogesh,
    I want to carry forward certain environment variables which we are using all virtual hosts configured in our apache web server.
    e.g., #1: Virtual hosts used in dispatcher will be same as the ServerName used in our Apache Virtualhost configuration
    e.g.. #2: Using environment variables to identify custom docroot in our web cluster based on VirtualHost configuration.
    Any thoughts?
    Thanks
    Suresh

  • 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

  • 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>

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

  • Accessing environment variables in PL/SQL??

    I have two oracle schemas; myenv1 and myenv2. They are both exact copies from each other except for the fact that one is my "developement" environment and the other my "production" environment.
    So in each of them I have some packages with PL/SQL code.
    I'd like to have an environment variable called PLATFORM (maybe not the best name) that should have the value "devel" in one schema and the value "prod" in the other schema. And I'd like to be able to access this variable in my PL/SQL code so I can slightly change some code or conditionate some code to the production environment only... or stuff like that.
    Does anyone know how to do that? (where and how to configure the env. variable)
    Any help will be most appreciated.
    Thanks!

    but I'm using the same 'current_user' in both schemas... is there other values I can get with sys_context ?? maybe there's one that would do it... but i think it's not 'current_user' It should be. Consider:
    SQL> show user
    USER is "SCOTT"
    SQL> create or replace function show_user return varchar2
      2  as
      3  begin
      4    return sys_context('userenv','current_user');
      5  end show_user;
      6  /
    Function created.
    SQL> select show_user from dual;
    SHOW_USER
    SCOTT
    SQL> grant execute on show_user to test;
    Grant succeeded.
    SQL> connect test/test
    Connected.
    SQL> select scott.show_user from dual;
    SHOW_USER
    SCOTT

  • Passing Apache (or OHS) environment variables to WebLogic

    Hi,
    AJP is the protocol used to proxy a Tomcat or Jetty container with Apache HTTP server. Apache environment variables can be passed along to the Java container, instead of using rather insecure HTTP headers.
    Is there a way to do the same thing using Apache and mod_weblogic, or using OHS and mod_wl_ohs? From what I've read, these modules are rather pure HTTP proxies. See for instance this post [1].
    The idea behind this is to integrate a Shibboleth Service Provider (mod_shib on Apache) with WebLogic, using an Identity Assertion Provider in WebLogic to establish user identities. Shibboleth advises NOT to use headers, and use environment variables instead (see [2]), but it seems that the configuration of perimetric authentication for WebLogic should rely on headers to extract username and other info (see [3] and [4]).
    Thanks a lot,
    /ben
    [1] https://groups.google.com/group/shibboleth-users/browse_thread/thread/af5e7caf7c9bbc0b/7933e991cfcbe089?pli=1
    [2] https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPSpoofChecking
    [3] http://docs.oracle.com/cd/E21764_01/web.1111/e14395/apache.htm#CDEBCGBI
    [4] http://docs.oracle.com/cd/E21764_01/web.1111/e13718/ia.htm#DEVSP248 ==> Passing Tokens for Perimeter Authentication

    Hi, thanks for the answer.
    However, this is not what I meant with "environment variables". I'm not referring to system environment variables, but to session environment variables of the Apache HTTP server, that it can pass along with requests to a Java container. This mechanism is possible with a Tomcat or Jetty container placed behind a Apache front-end, thx to AJP.
    I'm wondering how to do this with Weblogic, which does not support AJP.
    /ben

  • EA3/EA2/EA1 - Bind Variables in PL/SQL

    EA1 seems to have taken a backward step when it comes to supporting bind variables in PL/SQL.
    Back in 1.1.3, according to the bugs fixed list, we apparently fixed bug 5884935 (BINDS IN A PL/SQL STATEMENT HAS "NOT ALL VARIABLES BOUND" ERROR), although this was only ever when running as scripts (as per Bind variables in PLSQL bug not fixed?
    Now according to the 1.2 documentation, bind variables are not supported in the script runner (section 1.7.2) and the SQL*Plus variable command is not supported (section 1.7.1). However, I can run the following code "successfully" (no errors reported but the substitution text entered does not appear in the dbms_output):
    variable bind_text varchar2(30);
    declare
    l_text varchar2(30);
    begin
    :bind_text := '&sub_text';
    dbms_output.put_line('Bind text: "' || :bind_text || '"');
    end;
    Now in EA1, running this as a script results in "ORA-01006: bind variable does not exist"
    Running the variable statement results in "ORA-00900: Invalid SQL Statement" and running the PL/SQL results in "ORA-1008: not all variables bound".
    Can someone from the SQL Developer team please comment on the intended support for bind variables in PL/SQL?
    Thanks,
    theFurryOne

    I know that the variable command isn't supported (as I said above), but that was also the case in 1.2, where it did actually sort of work.
    I am not talking about local PL/SQL variables declared within the PL/SQL - I am trying to get user entered values into the PL/SQL in the same way as prompting for bind variable values in SQL.
    So using SQL Developer bind variables inside PL/SQL is my end goal - preferably when running anonymous PL/SQL blocks as statements in the worksheet.
    However, as there have been "fixed" bugs to enable bind variables in PL/SQL, which require the use of SQL Plus commands that are not supported in SQL Developer (ie variable), I am trying to work out what the development team think the intended support for bind variables in PL/SQL is. Then I will know if what I want needs to be reported as a bug or logged as an enhancement request.
    theFurryOne

  • Using environment variables in the JAR manifest

    Hello,
    I need to make a JAR which uses some third party libraries located in the file system, in a path referenced through a environment variable (named for example ENV_VAR). Without using the JAR the application may be started by running:
    java -classpath %ENV_VAR%\lib\library1.jar;%ENV_VAR%\lib\library2.jar MyApplication
    So what is the syntax to refer to environment variable inside the manifest?

    I guess its not possible. If you look at the [Manifest specification|http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html#JAR%20Manifest] there is nothing that inidcates that environment variables can be used. The classpath attribute is specified as follows:
    The value of this attribute specifies the relative URLs of the extensions or libraries that this application or extension needs. URLs are separated by one or more spaces. The application or extension class loader uses the value of this attribute to construct its internal search path.
    So actually, if it would be possible the ENV_VAR pathes must be set relative to your application .jar file.
    Why not just use a batch that sets up your command line as in the example and runs your app?

  • Please help!!!! URGENT !!!! using environment variable

    How do I use the environment variable in my sql script.
    example:
    I am setting up environment variables through my .bat file. The batch file contain the following lines...
    SET ORACLE_SID=test
    SET SID_PWD=test
    SQLPLUS /NOLOG @C:\TEST.SQL
    In my TEST.SQL script, I have a single line as follows..
    CONNECT INTERNAL/%SID_PWD%@%ORACLE_SID%
    My problem is I am not able connect, because my CONNECT statement does not have the values for the variable.
    Please help me how to solve this
    thanks
    kamal

    Pokaloorie;
    If you are working with a local database, you can simply omit the Oracle Sid in your connect string. Make your test.sql file say
    connect "/ as sysdba"
    Regards,
    Russ

  • Environment Variable Values

    Hi all,
    how do i get the environment variables in PL/SQL on Windows NT/2000 or SUN environment..?
    Thanks.

    hi Andrew P Clarke ,
    Thanks for ur immediate reply. That's fine, using sys_context. But i'm not asking thatt...sorrry i didn't specified clearly.
    My question is how do i get the Operating system - User defined system variables. (Ex: in Win 2000 Server Box i've creadted the sysvariable like TEST='C:\TEST\FILE\', like our V$parameter in ORACLE...in 'C'/JAVA we will use the function "GETENV".
    Similllar one in oracle. how do i get the value?
    Thank You very much for ur help and OTN.

  • How to Print the Value of a variable inside a PL/SQL package

    Hi Friends,
    Here is my Scenario
    I have a PL/SQL Package. Let us call it Baseline Package.
    This Package includes a dynamically built merge Statement.
    Execute Immediate v_merge_query.
    I have a procedure which replaces which few Keywords from the Package Text and Creates a new one depending on Inputs I provide. (This is something like a Code generator)
    Now while Creating the new package, I need to print the Value of v_merge_query.... I Need s Static Query to be Printed inside the new package and not a dynamic query.
    My Question is "Is there a way to print the value of the variable inside a different PL/SQL package?
    Thanks in Advance,
    Mohit

    Print where?
    That PL/SQL code is server-side code. It runs in an Oracle server process.
    That server process does not have a keyboard. Or a screen/monitor. Or display canvas. Or an attached printer.
    That server process is incapable of "printing" as that is not its job or responsibility and not part of its environment.
    What is can do is record data for the client to look at afterwards. This can be done using static PL/SQL session variables. Or a SQL table.
    The former is done by DBMS_OUTPUT - a very primitive interface for writing text into a static PL/SQL string array. That btw resides in expensive private process server memory. The client can query the array after a database call and render the contents.
    PS. Also keep in mind that bind variables are critical for performance and server robustness - especially when (ab)using dynamic SQL.

  • 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
    # =========================================

Maybe you are looking for

  • Logic Required

    Hi All, Pl find the requirement below. We have a inventory report in that we were showing the stock as on date and the value of that stock. This inventory data ( Stock Only) will come from AFS( SAP System) as well as Non-SAP System.To calculate the s

  • Safari 7.1 update not recognized

    When I open the App Store on my iMac with Mavericks, and click on the UPDATES tab, it tells me that on Sep 20 I installed 10.9.5.  Safari 7.1 was installed on Sep 21, and 2x on Sep 22 and it still wants me to update again.  When I have Safari open an

  • How can I get rid of "Jagged Edges" in FCP from .psd/.tif/.tga text files?

    Hi guys, I posted this once before but don't know if anyone looked at it or not. I am getting "Jagged Edges" in .psd/ .jpg/ .tif/ .tga text files when I edit them in FCP5.1.4. What is going wrong? It is getting very frustrating for me at this point.

  • JSF-ADF //  no more connection ? // database unreachable

    Hi, I developed a very simple application with a list on one page, an edit form on a second and a create form on a third page. Easy. No login. Everything seems ok but after a certain amount of time, creation and edit don't work anymore. After a while

  • Is it possible to adjust the interface of the Adobe products in the suites

    I run my resiloution at 1600 X 1200 on both my moniotrs and when I open any Adobe product the words like "file,edit etc" are so small I can't see them very good, my tool bar is very small. If I lower my screen resiloution they get bigger but then eve