Sys_context error

Dear Friends,
I created a function in database 10g to get OS name in Oracle Forms Version 6i.
CREATE OR REPLACE FUNCTION fn1 RETURN CHAR IS
tname VARCHAR2(200);
BEGIN
tname := UPPER(sys_context('USERENV','OS_USER'));
RETURN tname;
END;
To get Os name in forms, I used this query
SELECT FN1 INTO uname FROM DUAL;
It was working fine, but then stopped suddenly and started giving error message ORA-00904 Invalid Number
Noting was changed in the form, and from yesterday it started giving this error. Can anybody give me idea about what has happened to it
Regards,
Arshad

hi
you can define Cursor something like this.I think you do not need to define function for that.
declare
cursor
os_usr is select sys_context('USERENV','OS_USER') from dual;
begin
open os_usr;
fetch os_usr into :item;
close os_usr;
end;
SELECT FN1 INTO uname FROM DUAL; ------ you forgot to put :
or
SELECT FN1 INTO :uname FROM DUAL;hope this helps u
sarah

Similar Messages

  • Sys_context - Error in Oracle 8 Database

    I am using sys_context but it gives error message.
    SELECT SYS_CONTEXT ('userenv', 'host') FROM dual
    ------ it gives following message
    SELECT SYS_CONTEXT ('userenv', 'host') FROM dual
    ERROR at line 1:
    ORA-00904: invalid column name
    Pl. help me urgently
    My database is ORACLE 8.

    Please post your technical questions [url http://forums.oracle.com/forums/forum.jsp?forum=61]here for quick response.
    Regards,
    Anupama
    [url http://otn.oracle.com/sample_code/]OTN Sample Code

  • Error in substr(sys_context('userenv','ip_address'),1,20)

    Hi GURUS,
    I m new to oracle here i created a table in oracle 10g(10.1.0.2.0) named
    create table iv_master(
    iv_code varchar2(6) not null,
    iv_name varchar2(50) not null,
    created_at varchar2(15) default substr(sys_context('userenv','ip_address'),1,20),
    created_on date default sysdate,
    created_by varchar2(5) not null,
    modified_at varchar2(15) default substr(sys_context('userenv','ip_address'),1,20),
    modified_on date default sysdate,
    modified_by varchar2(5) not null,
    constraint iv_master_pk primary key(iv_code))
    Now i want to remove this 'default' keyword in created_at & modified_at fields
    i tried alter table command but it is not working.tell me the way to remove this default keyword and also in created_on ,modified_on..(without dropping the table)
    i tried the following statement,
    create table test (ipaddr varchar2(20) SUBSTR(SYS_CONTEXT('USERENV','IP_ADDRESS')1,20));
    but i m getting.this following error
    ERROR at line 1:
    ORA-00922: missing or invalid option
    pls tell me where i m wrong...and also tell me the query to do it...
    Advance thanks for all...

    Hi,
    bharathit wrote:
    Hi GURUS,
    I m new to oracle here i created a table in oracle 10g(10.1.0.2.0) named
    create table iv_master(
    iv_code varchar2(6) not null,
    iv_name varchar2(50) not null,
    created_at varchar2(15) default substr(sys_context('userenv','ip_address'),1,20),
    created_on date default sysdate,
    created_by varchar2(5) not null,
    modified_at varchar2(15) default substr(sys_context('userenv','ip_address'),1,20),
    modified_on date default sysdate,
    modified_by varchar2(5) not null,
    constraint iv_master_pk primary key(iv_code))
    Now i want to remove this 'default' keyword in created_at & modified_at fieldsYou can't have the default functionality without the "DEFAULT" keyword.
    Are you saying that you no longer want a default value? That's the same as saying DEFAULT NULL, and you can change the table like this:
    ALTER TABLE  iv_master
    MODIFY       ( created_at     DEFAULT NULL
              , modified_at     DEFAULT NULL
              );Edited by: Frank Kulash on Feb 17, 2010 12:59 PM
    Changed ALTER TABLE example to modify both columns.

  • Error In After Logon Trigger

    Hi,
        I am using Release 11.2.0.3.0 of oracle.
    I have created a trigger for restricting specific users(logging from specific program and having specific OSUSER) from loging into the database.
    I created below trigger in SYS schema.
    CREATE OR REPLACE TRIGGER t1
    AFTER
    LOGON
    ON DATABASE
    DECLARE
    trg_program varchar2(4000);
    trg_user varchar2(4000);
    trg_osuser varchar2(4000);
    v_killsession  VARCHAR2(4000);
    v_sid   VARCHAR2(4000);
    v_serial   VARCHAR2(4000);
    BEGIN
    SELECT UPPER (program), UPPER (USERNAME), UPPER (OSUSER),SID,serial#
      INTO trg_program, trg_user, trg_osuser,v_sid,v_serial
      FROM v$session
    WHERE audsid = SYS_CONTEXT ('USERENV', 'SESSIONID') AND ROWNUM = 1;
    IF  trg_program IN ('SQLPLUS.EXE','SQLPLUSW.EXE','TOAD.EXE')
        AND  trg_user in ('USER1','USER2')--,'SYS','SYSTEM')
        --AND trg_osuser  not in ('O12345')
    THEN
           raise_application_error(-20001,'You are not authorized to connect to this schema directly!!');
    END IF;   
    END;
    when i am logging into USER1 through sqlplus/toad it works fine, i am getting required message which is mentioned as 'raise application error'
    but when i am compiling the trigger by uncommenting extra condition for OSUSER i.e trg_osuser  not in ('O12345') in the trigger code, so that it wont affect the highly provileged user(i.e OSUSER O12345).During logging in to user USER1 i am getting below error
    ERROR:
    ORA-04045: errors during recompilation/revalidation of
    XIGNCMN.RESTRICT_UNAUTH_ACCESS
    ORA-01031: insufficient privileges
    it should alow me to login because i am OSUSER 'O12345', so why its not working?

    Thanks John.
    Actually currently we are having database server installed in each of the developers machine so having DBA privilege and having business data, thats why i am planning to configure common database to which all will connect and i wont allow them to connect to the database directly through the functional schema(2 schemas). Now i am planning to restrict the developers access to only 'SELECT+DMLS' for the functional schema and i will do that by creating another user through which they will get connected to the actual functional schema with restricted privilege.
    But here the issue is that, for JAVA application, they are having local source code in each of their machine and will also need the connection string/password for the functional schema, so they will know the password for the functional schema, but i want to restrict their access through all the program except 'Jdbc thin client' so i thought of above trigger.
    kindly suggest if any other way out?

  • Error while executing the code as sys user

    Hi,
    Below is the code that creates a procedure. Though the proc gets created successfully, while trying to execute it, I get the below error
    ORA-01031: insufficient privileges
    ORA-06512: at "SYS.DBMS_SESSION", line 101
    ORA-06512: at "SYS.MY_TEST_PROC", line 20
    ORA-06512: at line 1
    The proc is created by sys and executed by sys too
    create or replace procedure my_test_proc as
    TYPE CUR1 IS REF CURSOR;
    CURSOR c1 is
    select ename from SCOTT.emp where rownum <2;
    v_name varchar2(30);
    MY_CUR CUR1;
    STRQRY VARCHAR2(2000);
    L_PARAM DBMS_SQL.VARCHAR2S;
    CNT NUMBER;
    V_DATA SCOTT.EMP%ROWTYPE;
    BEGIN
    STRQRY := 'SELECT * FROM SCOTT.EMP WHERE 1 =1 and (( 1= 1) ';
    CNT := 0;
    open c1;
    loop
    fetch c1 into v_name;
    exit when c1%notfound;
    CNT := CNT + 1;
    dbms_session.set_context('MY_CTX','ENAME_' || CNT, V_NAME);
    STRQRY := STRQRY || ' OR (ENAME = SYS_CONTEXT(''MY_CTX'',''ENAME_1'')';
    end loop;
    DBMS_OUTPUT.PUT_LINE(STRQRY || ')');
    CLOSE C1;
    END my_test_proc;
    ============================================================
    EXEC my_test_proc;
    Please help.

    >
    STRQRY := 'SELECT * FROM SCOTT.EMP WHERE 1 =1 and (( 1= 1) ';
    >
    The above query won't work because there is a syntax error.
    Count the numbers of left and right parentheses.
    Edit your post and use code tags and tell us which is line #20.
    My guess is that it is this line
    dbms_session.set_context('MY_CTX','ENAME_' || CNT, V_NAME); You don't show any code for the CONTEXT procedure. DBMS_SESSION.SET_CONTEXT in the PL/SQL Packages and Types doc
    See http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_sessio.htm#i1010942
    >
    The caller of SET_CONTEXT must be in the calling stack of a procedure that has been associated to the context namespace through a CREATE CONTEXT statement. The checking of the calling stack does not cross a DBMS boundary.

  • SQlldr Error while uploading "excel" or "csv" file.

    Hello to community,
    We are using Oracle AS(application Server) 10g as a "web Server" & "database Server"
    The Database Server is having an NFS Partition,which has mounted onto "Web Server"
    So, if any client tried to upload any excel OR csv file , the Web Server will redirect that file data onto "database" server" through NFS partition.
    By clicking "upload" button from client end, they are getting a strange error. By checking "ias_console" log file, I have found below latest logs,which belongs to the error. Kindly let me know where is the problem coming from.
    The Database Server Shared NFS partition name is "web_upload" & we have same "web_upload" partition on the "web server". The command of mounting NFS partition is given below.
    On AIX web Server :- mount <ip address>:/file_data/web_upload/ /web_upload/
    SYNTAX :- <ip add of db server>/mount point "web server mount point"
    The error is as given below.
    09/06/09 15:27:47 NumIdle: 2
    09 Jun 2009 15:27:47,764 [DEBUG] - [ com.vat.website.service.DatabaseService ] [ private Connection getDBConnection() ] Exited
    09 Jun 2009 15:27:47,764 [DEBUG] - [ com.vat.website.service.DatabaseService ] [ private Connection getDBConnection() ] Exited
    09 Jun 2009 15:27:47,766 [DEBUG] - [ com.vat.website.service.DatabaseService ] [ private void initialize() ] After getDBConnection called,
      connection object is: org.apache.commons.dbcp.PoolableConnection@1048a893
    09 Jun 2009 15:27:47,767 [DEBUG] - [ com.vat.website.service.ExcelUploadService ] [ public boolean insertFileDetails(ExcelDataBean databean,String
      strFname) ] strUniqueKey:select  web_uploaded_file_history_seq.nextval from dual
    09 Jun 2009 15:27:47,767 [DEBUG] - [ com.vat.website.service.DatabaseService ] [ public ResultSet executeQuery(String strQuery) ] Entered
    09 Jun 2009 15:27:47,773 [DEBUG] - [ com.vat.website.service.DatabaseService ] [ public ResultSet executeQuery(String strQuery) ] Exited
    09 Jun 2009 15:27:47,774 [DEBUG] - [ com.vat.website.service.ExcelUploadService ] [ public boolean insertFileDetails(ExcelDataBean databean,String
      strFname) ] insertQuery:INSERT INTO WEB_UPLOADED_FILE_HISTORY(WUF_SERIAL_NUMBER,WUF_DEALER_ID,WUF_PERIOD_FROM,WUF_PERIOD_TO,WUF_FILE_PATH,WUF_FORM_NO,WUF_SERVER_IP,WUF_UPLOAD_YN,WUF_CREATED_DATE,WUF_CREATED_BY,WUF_ORIGINAL_REVISED,WUF_SHEETS_NUMBER,wuf_reco
      d_key)VALUES('2658271','T00100001000306',to_date('01/01/2009','dd/mm/yyyy'),to_date('31/01/2009','dd/mm/yyyy'),'/web_upload/090609/VAT
      Returns/000000/0000000000/Form201/0000000000_0T201BO0109_009062009152747.csv',replace(decode('T201B','T201M', 'T201','T201B'),'T','VAT-Form'),(select
      RPAD(sys_context('USERENV','IP_ADDRESS'),15,' ') AS client_ipaddress from dual),'Y',SYSDATE,'WEB','O','0','3317063')
    09 Jun 2009 15:27:47,791 [DEBUG] - [ com.vat.website.service.DatabaseService ] [ public void closeDBConnection() ] Entered
    09 Jun 2009 15:27:47,791 [DEBUG] - finalDate:01-JAN-2009
    09 Jun 2009 15:27:47,792 [DEBUG] - finalDate:31-JAN-2009
    09 Jun 2009 15:27:47,806 [DEBUG] - [ com.vat.website.utils.PropertyCache ] [ static Object getValue(String propertyName, String propertyFileName)
      ] Entered
    09 Jun 2009 15:27:47,806 [DEBUG] - [ com.vat.website.utils.PropertyCache ] [ static Object getValue(String propertyName, String propertyFileName)
      ] Entered
    09 Jun 2009 15:27:47,806 [DEBUG] - [ com.vat.website.utils.PropertyCache ] [ static Object getValue(String propertyName, String propertyFileName)
      ] Entered
    09 Jun 2009 15:27:47,806 [DEBUG] - [ com.vat.website.action.UploadAction ] [ public ActionForward submit(ActionMapping mapping, ActionForm
      form,HttpServletRequest request, HttpServletResponse response) ] Executing: sqlldr parfile=parafile.par silent=feedback direct=Y at location:
      /web_upload/090609/VAT Returns/000000/0000000000/Form201/SQLLdr
    It seems that this problem is due to "Sqlldr" then how to troubleshoot this problem?
    Waiting for your favorable response,
    Advanced Thanks,
    Nishith Vyas.

    Flat File was in error.

  • Error in ONS logs while implmenting FCF on oracle RAC from java program

    I have java prog on client machine that uses properties from a property file.While making the connection to the ONS port on the oracle RAC server to implement FCF the program is throwing error as below:
    java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
    and when i checked the ons logs for that node the logs are as follows:
    Connection 5,199.xxx.xxxxxx,8200 header RCV failed (Connect
    ion reset by peer) coFlags=1002a
    These logs are generated only when java program tries to connect else the daemon started without any errors.
    But sometime it connets and gives the desired output.
    Please advice and do let me know in case you need more information.
    Java program on the client machine is as follows..
    * Oracle Support Services
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.Enumeration;
    import java.util.Properties;
    import java.util.ResourceBundle;
    import oracle.jdbc.pool.OracleConnectionCacheManager;
    import oracle.jdbc.pool.OracleDataSource;
    public class FCFConnectionCacheExample
    private OracleDataSource ods = null;
    private OracleConnectionCacheManager occm = null;
    private Properties cacheProperties = null;
    public FCFConnectionCacheExample() throws SQLException
    // create a cache manager
    occm = OracleConnectionCacheManager.getConnectionCacheManagerInstance();
    Properties props = loadProperties("fcfcache");
    cacheProperties = new java.util.Properties();
    cacheProperties.setProperty("InitialLimit", (String)props.get("InitialLimit"));
    cacheProperties.setProperty("MinLimit", (String)props.get("MinLimit"));
    cacheProperties.setProperty("MaxLimit", (String)props.get("MaxLimit"));
    ods = new OracleDataSource();
    ods.setUser((String)props.get("username"));
    ods.setPassword((String)props.get("password"));
    ods.setConnectionCachingEnabled(true);
    ods.setFastConnectionFailoverEnabled(true);
    ods.setConnectionCacheName("MyCache");
    ods.setONSConfiguration((String)props.get("onsconfig"));
    ods.setURL((String)props.get("url"));
    occm.createCache("MyCache", ods, cacheProperties);
    private Properties loadProperties (String file)
    Properties prop = new Properties();
    ResourceBundle bundle = ResourceBundle.getBundle(file);
    Enumeration enumlist = bundle.getKeys();
    String key = null;
    while (enumlist.hasMoreElements())
    key = (String) enumlist.nextElement();
    prop.put(key, bundle.getObject(key));
    return prop;
    public void run() throws Exception
    Connection conn = null;
    Statement stmt = null;
    ResultSet rset = null;
    String sQuery =
    "select sys_context('userenv', 'instance_name'), " +
    "sys_context('userenv', 'server_host'), " +
    "sys_context('userenv', 'service_name') " +
    "from dual";
    try
    conn = null;
    conn = ods.getConnection();
    stmt = conn.createStatement();
    rset = stmt.executeQuery(sQuery);
    rset.next();
    System.out.println("-----------");
    System.out.println("Instance -> " + rset.getString(1));
    System.out.println("Host -> " + rset.getString(2));
    System.out.println("Service -> " + rset.getString(3));
    System.out.println("NumberOfAvailableConnections: " +
    occm.getNumberOfAvailableConnections("MyCache"));
    System.out.println("NumberOfActiveConnections: " +
    occm.getNumberOfActiveConnections("MyCache"));
    System.out.println("-----------");
    catch (SQLException sqle)
    while (sqle != null)
    System.out.println("SQL State: " + sqle.getSQLState());
    System.out.println("Vendor Specific code: " +
    sqle.getErrorCode());
    Throwable te = sqle.getCause();
    while (te != null) {
    System.out.print("Throwable: " + te);
    te = te.getCause();
    sqle.printStackTrace();
    sqle = sqle.getNextException();
    finally
    try
    rset.close();
    stmt.close();
    conn.close();
    catch (SQLException sqle2)
    System.out.println("Error during close");
    public static void main(String[] args)
    System.out.println(">> PROGRAM using JDBC thin driver no oracle client required");
    System.out.println(">> ojdbc14.jar and ons.jar must be in the CLASSPATH");
    System.out.println(">> Press CNTRL C to exit running program\n");
    try
    FCFConnectionCacheExample test = new FCFConnectionCacheExample();
    while (true)
    test.run();
    Thread.currentThread().sleep(10000);
    catch (InterruptedException e)
    System.out.println("PROGRAM Ended by user");
    catch (Exception ex)
    System.out.println("Error Occurred in MAIN");
    ex.printStackTrace();
    Some of the info i have deleted intensionally as this is confidential
    Property file is as follows
    # properties required for test
    username=test
    password=test
    InitialLimit=10
    MinLimit=10
    MaxLimit=20
    onsconfig=nodes=RAC-node1:port,RAC-node2:port
    url=jdbc:oracle:thin:@(DESCRIPTION= \
    (LOAD_BALANCE=yes) \
    (ADDRESS=(PROTOCOL=TCP)(HOST=RAC-node1)(PORT=1521)) \
    (ADDRESS=(PROTOCOL=TCP)(HOST=RAC-node1)(PORT=1521)) \
    (CONNECT_DATA=(service_name=RAC_SERVICE)))

    Hi;
    Please check below note:
    Link Errors While Installing CRS & RAC Database software [ID 438747.1]
    Codeword File $TIMEBOMB_CWD,/opt/aCC/newconfig/aCC.cwd Missing Or Empty [ID 552893.1]
    Regard
    Helios

  • Error while using VPD

    Sir,
    I have created the policy in database and it is functioning fine in SQL*Plus. While implementing it in HTMLDB, i specify following code in Application Attributes VPD Section:
    begin
    app_security_context.set_appuser(:APPUSER);
    end
    This package exists in default parsing schema of the application and has following code:
    PACKAGE BODY APP_SECURITY_CONTEXT
    IS
    /*Following procedure will set the context for*/
    PROCEDURE set_appuser(p_username in varchar2)
    IS
    v_username varchar2(30);
    BEGIN
    select upper(username) into v_username
    from app_users
    where upper(app_users.username)=upper(p_username);
    --setting the application context
    DBMS_SESSION.SET_CONTEXT('PLUTO_CONTEXT','APPUSER',v_username);
    END set_appuser;
    END;
    But, when i run the application it shows no data found error on the very first page with following HTMLDB Error:
    Error      ERR-1181 Unable to set VPD security context on page show.
    ORA-1403: no data found
    Regards,
    Manpreet Johal

    This is very cool.
    I am so used to jsp development, setting the context in every anonymous block call to the database. All insert statements I have are wrapped in packages and I had basically given on using the built in tabular forms and such because I didn't know how to set the app context other than this way:<br><br>
    BEGIN
      pkg_login.validate_session( :F100_SESSIONID );
      insert_new_row( :P1_X, :P1_Y, :P1_Z );
    END;<br>
    I had to include that (and the appropriate PRAGMA EXCEPTION_INIT statements to catch invalid/expired sessions in all my page processes that called functions/procedures. Still thinking in jsp.<br><br>
    Just to make sure that it did in fact work, I added a function call to the VPD section of the Application Attributes:<br><br>
    DECLARE
      session_expired EXCEPTION;
      invalid_session EXCEPTION;
      PRAGMA EXCEPTION_INIT(session_expired, -20101);
      PRAGMA EXCEPTION_INIT(invalid_session, -20100);
    BEGIN
      IF htmldb_custom_auth.current_page_is_public = FALSE THEN
        p_login.validate_session( :F100_SESSIONID );
      ELSIF htmldb_custom_auth.current_page_is_public = TRUE AND :F100_SESSIONID IS NOT NULL THEN
        p_login.validate_session( :F100_SESSIONID );
      END IF;
    EXCEPTION
      WHEN session_expired OR invalid_session THEN
         htp.init;
         owa_util.redirect_url('f?p=&APP_ID.:501:&APP_SESSION.::::P501_FORCED:YES', true);
    END;<br>
    I then created a table:<br><br>
    CREATE TABLE t
      x NUMBER(10),
      y VARCHAR2(30),
      z VARCHAR2(30) DEFAULT SYS_CONTEXT( 'MY_CONTEXT', 'EMAILADDRESS' ) --EMAIL ADDRESS is one of the key=value pairs I defined and set on login
    );<br>
    and built a tabular form on it.
    Added a row, inserted a value (column x), and voila! There's it is.<br><br>
         X Y                              Z
      2897 ASDFASDF                       [email protected]
      2898 asdf                           [email protected]<br>
    very cool indeed.<br><br>
    chet

  • VPD: Column Level Masking - Error: ORA-28104: input value for sec_relevant_cols is not valid

    Hi Gurus,
    I am trying to mask the secured column from the table for one specified user, Here is the detail of DB and code which I am using to apply the security:
    DB Version: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0
    Security Function:
    create or replace function kr_sec_function_papf(p_object_schema IN VARCHAR2,
    p_object_name VARCHAR2)
    return varchar2
    as
    p_nid varchar2(200);
    whoami varchar2(100);
    begin
    if SYS_CONTEXT('USERENV', 'SESSION_USER') = 'VPDTEST'
    then
    p_nid := 'national_identifier = national_identifier';
    return (p_nid);
    else
    p_nid := '1=2';
    return (p_nid);
    end if;
    end kr_sec_function_papf;
    Code to Add Policy:
    BEGIN
    DBMS_RLS.ADD_POLICY(
    object_schema => 'APPS',
    object_name => 'PER_ALL_PEOPLE_F',
    policy_name => 'secure_emp',
    policy_function => 'kr_sec_function_papf',
    statement_types => 'SELECT',
    sec_relevant_cols=>'NATIONAL_IDENTIFIER',
    sec_relevant_cols_opt=>DBMS_RLS.ALL_ROWS);
    END;
    I am getting error while executing the above plsql block, Error is:
    ORA-28104: input value for sec_relevant_cols is not valid
    ORA-06512: at "SYS.DBMS_RLS", line 20
    ORA-06512: at line 2
    Any one please help me to resolve the issue.
    Thanks in Advance.
    ~Krishna Nand Singh

    Hi Every one,
    I got this issue resolved.
    The issue is with parameter object_schema => 'APPS' , the object schema name is 'HR' and APPS has synonym with the same name.
    The Correct code should be:
    BEGIN
    DBMS_RLS.ADD_POLICY(
    object_schema => 'HR',
    object_name => 'PER_ALL_PEOPLE_F',
    policy_name => 'secure_emp',
    policy_function => 'kr_sec_function_papf',
    statement_types => 'SELECT',
    sec_relevant_cols=>'NATIONAL_IDENTIFIER',
    sec_relevant_cols_opt=>DBMS_RLS.ALL_ROWS);
    END;
    Thanks,
    Krishna Nand Singh

  • Error ORA-39125 and ORA-04063 during export for transportable tablespace

    I'm using the Oracle Enterprise Manager (browser is IE) to create a tablespace transport file. Maintenance...Transport Tablespaces uses the wizard to walk me through each step. The job gets created and submitted.
    The 'Prepare' and 'Convert Datafile(s)' job steps complete successfully. The Export step fails with the following error. Can anyone shed some light on this for me?
    Thank you in advance!
    =======================================================
    Output Log
    Export: Release 10.2.0.2.0 - Production on Sunday, 03 September, 2006 19:31:34
    Copyright (c) 2003, 2005, Oracle. All rights reserved.
    Username:
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Starting "SYS"."GENERATETTS000024": SYS/******** AS SYSDBA dumpfile=EXPDAT_GENERATETTS000024.DMP directory=EM_TTS_DIR_OBJECT transport_tablespaces=SIEBEL job_name=GENERATETTS000024 logfile=EXPDAT.LOG
    Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
    Processing object type TRANSPORTABLE_EXPORT/TABLE
    Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
    ORA-39125: Worker unexpected fatal error in KUPW$WORKER.UNLOAD_METADATA while calling DBMS_METADATA.FETCH_XML_CLOB [TABLE_STATISTICS]
    ORA-04063: view "SYS.KU$_IOTABLE_VIEW" has errors
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
    ORA-06512: at "SYS.KUPW$WORKER", line 6241
    ----- PL/SQL Call Stack -----
    object line object
    handle number name
    2CF48130 14916 package body SYS.KUPW$WORKER
    2CF48130 6300 package body SYS.KUPW$WORKER
    2CF48130 2340 package body SYS.KUPW$WORKER
    2CF48130 6861 package body SYS.KUPW$WORKER
    2CF48130 1262 package body SYS.KUPW$WORKER
    2CF0850C 2 anonymous block
    Job "SYS"."GENERATETTS000024" stopped due to fatal error at 19:31:44

    More information:
    Using SQL Developer, I checked the view SYS.KU$_IOTABLE_VIEW referred to in the error message, and it does indeed report a problem with that view. The following code is the definition of that view. I have no idea what it's supposed to be doing, because it was part of the default installation. I certainly didn't write it. I did, however, execute the 'Test Syntax' button (on the Edit View screen), and the result was this error message:
    =======================================================
    The SQL syntax is valid, however the query is invalid or uses functionality that is not supported.
    Unknown error(s) parsing SQL: oracle.javatools.parser.plsql.syntax.ParserException: Unexpected token
    =======================================================
    The SQL for the view looks like this:
    REM SYS KU$_IOTABLE_VIEW
    CREATE OR REPLACE FORCE VIEW "SYS"."KU$_IOTABLE_VIEW" OF "SYS"."KU$_IOTABLE_T"
    WITH OBJECT IDENTIFIER (obj_num) AS
    select '2','3',
    t.obj#,
    value(o),
    -- if this is a secondary table, get base obj and ancestor obj
    decode(bitand(o.flags, 16), 16,
    (select value(oo) from ku$_schemaobj_view oo, secobj$ s
    where o.obj_num=s.secobj#
    and oo.obj_num=s.obj#),
    null),
    decode(bitand(o.flags, 16), 16,
    (select value(oo) from ku$_schemaobj_view oo, ind$ i, secobj$ s
    where o.obj_num=s.secobj#
    and i.obj#=s.obj#
    and oo.obj_num=i.bo#),
    null),
    (select value(s) from ku$_storage_view s
    where i.file# = s.file_num
    and i.block# = s.block_num
    and i.ts# = s.ts_num),
    ts.name, ts.blocksize,
    i.dataobj#, t.bobj#, t.tab#, t.cols,
    t.clucols, i.pctfree$, i.initrans, i.maxtrans,
    mod(i.pctthres$,256), i.spare2, t.flags,
    t.audit$, t.rowcnt, t.blkcnt, t.empcnt, t.avgspc, t.chncnt, t.avgrln,
    t.avgspc_flb, t.flbcnt, t.analyzetime, t.samplesize, t.degree,
    t.instances, t.intcols, t.kernelcols, t.property, 'N', t.trigflag,
    t.spare1, t.spare2, t.spare3, t.spare4, t.spare5, t.spare6,
    decode(bitand(t.trigflag, 65536), 65536,
    (select e.encalg from sys.enc$ e where e.obj#=t.obj#),
    null),
    decode(bitand(t.trigflag, 65536), 65536,
    (select e.intalg from sys.enc$ e where e.obj#=t.obj#),
    null),
    (select c.name from col$ c
    where c.obj# = t.obj#
    and c.col# = i.trunccnt and i.trunccnt != 0
    and bitand(c.property,1)=0),
    cast( multiset(select * from ku$_column_view c
    where c.obj_num = t.obj#
    order by c.col_num, c.intcol_num
    ) as ku$_column_list_t
    (select value(nt) from ku$_nt_parent_view nt
    where nt.obj_num = t.obj#),
    cast( multiset(select * from ku$_constraint0_view con
    where con.obj_num = t.obj#
    and con.contype not in (7,11)
    ) as ku$_constraint0_list_t
    cast( multiset(select * from ku$_constraint1_view con
    where con.obj_num = t.obj#
    ) as ku$_constraint1_list_t
    cast( multiset(select * from ku$_constraint2_view con
    where con.obj_num = t.obj#
    ) as ku$_constraint2_list_t
    cast( multiset(select * from ku$_pkref_constraint_view con
    where con.obj_num = t.obj#
    ) as ku$_pkref_constraint_list_t
    (select value(ov) from ku$_ov_table_view ov
    where ov.bobj_num = t.obj#
    and bitand(t.property, 128) = 128), -- IOT has overflow
    (select value(etv) from ku$_exttab_view etv
    where etv.obj_num = o.obj_num)
    from ku$_schemaobj_view o, tab$ t, ind$ i, ts$ ts
    where t.obj# = o.obj_num
    and t.pctused$ = i.obj# -- For IOTs, pctused has index obj#
    and bitand(t.property, 32+64+512) = 64 -- IOT but not overflow
    -- or partitioned (32)
    and i.ts# = ts.ts#
    AND (SYS_CONTEXT('USERENV','CURRENT_USERID') IN (o.owner_num, 0) OR
    EXISTS ( SELECT * FROM session_roles
    WHERE role='SELECT_CATALOG_ROLE' ));
    GRANT SELECT ON "SYS"."KU$_IOTABLE_VIEW" TO PUBLIC;

  • Syntax error but I'm too blind to see...

    Using the below SQL from my usrStartFrm.ASP page to ORA 8i I have set a page variable = a session variable
    +++++++++++++++++++++++
    dim usrLoginID
    SUB usrStartFrm_onenter()
         usrLoginID = Session("LoginID")
    End SUB
    +++++++++++++++++++++++++
    But I cannot return records using the following syntax.
    SELECT DISTINCT
    L.LOGINID,
    B.BUSINESSSEGMENTNAME
    FROM SODA.ASSIGNMENTS_TB A,
    SODA.LOGINS_TB L,
    SODA.BUSSEGMENT_TB B
    WHERE A.FK_LOGIN_NO = L.LOGIN_NO
    AND
    A.FK_BUSSEGID = B.BUSSEGID AND
    (L.LOGINID = '" & usrLoginID &" ')
    ORDER BY B.BUSINESSSEGMENTNAME
    NOR DOES THIS
    ++++++++++++++++++++++++++++++++++++++++++++++++
    (L.LOGINID = '" & Session("LoginID") &" ')
    +++++++++++++++++++++++++++++++++++++++++++++++++
    BUT if I change the sytax to a hard code
    (L.LOGINID = 'ajgrasso')
    The query works.
    I know the page creates the variable because I print it out to the p;age as it loads..
    SO I figure it must be the bugaboo string single double qutes issue.
    Any Ideas.
    Thanks beforehand
    AJ

    It does help somewhat to see the complete code. I can now see and understand how you are building your select statement including your variable and storing the select statement to another variable to be executed. Unfortunately, I don't know enough about ASP and javascript and so forth to be certain of the correct code. However, I can see a lot of similarities between what you are doing and how we build a select statement in PL/SQL and store it to a variable for dynamic execution. There are various ways of including variables within that select statement. About the best I can do is offer various legitimate syntaxes in PL/SQL and hope that you can see the similarities and will be able to adapt one or more of them. In each of the examples below, which demonstrate slightly different methods, I have used current_user for the Oracle user, but you can substitute os_user for current_user in any of them if you want the operating system user. However, note that it will include the domain, like your_domain\ajgrasso so you may need to do some parsing for proper comparison. If you don't get any errors, but it also doesn't return any rows, it might be due to something like that. Notice that, when building a select statement and storing it to a variable, all single quotes within the string must be doubled. That is, replace each single quote with two single quotes (not double quotes) within the string. Also, in Oracle, || is the concatenation symbol, not &. However, because you are using ASP and javascript, if they require double quotes and &, then you may have to experiment with such substitutions. Please see what you can derive from the following and let us know. Also, if it doesn't work for you, please be specific as to whether it returns an error message or if it just doesn't return any rows. A cut and paste of the run, as I have done below, would help.
    SQL> -- test tables and data:
    SQL> SELECT * FROM scott.assignments_tb
      2  /
    FK_LOGIN_NO FK_BUSSEGID                                                        
              1           1                                                        
    SQL> SELECT * FROM scott.logins_tb
      2  /
      LOGIN_NO LOGINID                                                             
             1 SCOTT                                                               
    SQL> SELECT * FROM scott.bussegment_tb
      2  /
      BUSSEGID BUSINESSSEGMENTNAME                                                 
             1 SCOTT bussegname                                                    
    SQL>
    SQL>
    SQL> -- code samples using scott schema
    SQL> -- instead of soda schema:
    SQL>
    SQL>
    SQL> CREATE OR REPLACE PACKAGE types_pkg
      2  AS
      3    TYPE weak_ref_cursor_type IS REF CURSOR;
      4  END types_pkg;
      5  /
    Package created.
    SQL>
    SQL>
    SQL> CREATE OR REPLACE PROCEDURE test_procedure
      2    (p_weak_ref_cursor OUT types_pkg.weak_ref_cursor_type)
      3  AS
      4    CommandText VARCHAR2 (4000);
      5  BEGIN
      6    CommandText :=
      7    'SELECT      DISTINCT
      8             l.loginid,
      9             b.businesssegmentname
    10       FROM      scott.assignments_tb a,
    11             scott.logins_tb      l,
    12             scott.bussegment_tb  b
    13       WHERE      a.fk_login_no = l.login_no
    14       AND      a.fk_bussegid = b.bussegid
    15       AND      (l.loginid = SYS_CONTEXT (''USERENV'', ''CURRENT_USER''))
    16       ORDER BY b.businesssegmentname';
    17 
    18    OPEN p_weak_ref_cursor FOR CommandText;
    19  END test_procedure;
    20  /
    Procedure created.
    SQL> SHOW ERRORS
    No errors.
    SQL> VARIABLE g_ref REFCURSOR
    SQL> EXECUTE test_procedure (:g_ref)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    LOGINID                        BUSINESSSEGMENTNAME                             
    SCOTT                          SCOTT bussegname                                
    SQL>
    SQL>
    SQL> CREATE OR REPLACE PROCEDURE test_procedure
      2    (p_weak_ref_cursor OUT types_pkg.weak_ref_cursor_type)
      3  AS
      4    CommandText VARCHAR2 (4000);
      5  BEGIN
      6    CommandText :=
      7    'SELECT      DISTINCT
      8             l.loginid,
      9             b.businesssegmentname
    10       FROM      scott.assignments_tb a,
    11             scott.logins_tb      l,
    12             scott.bussegment_tb  b
    13       WHERE      a.fk_login_no = l.login_no
    14       AND      a.fk_bussegid = b.bussegid
    15       AND      (l.loginid = ' || 'SYS_CONTEXT (''USERENV'', ''CURRENT_USER'')' || ')
    16       ORDER BY b.businesssegmentname';
    17 
    18    OPEN p_weak_ref_cursor FOR CommandText;
    19  END test_procedure;
    20  /
    Procedure created.
    SQL> SHOW ERRORS
    No errors.
    SQL> VARIABLE g_ref REFCURSOR
    SQL> EXECUTE test_procedure (:g_ref)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    LOGINID                        BUSINESSSEGMENTNAME                             
    SCOTT                          SCOTT bussegname                                
    SQL>
    SQL>
    SQL> CREATE OR REPLACE PROCEDURE test_procedure
      2    (p_weak_ref_cursor OUT types_pkg.weak_ref_cursor_type)
      3  AS
      4    usrLoginID  VARCHAR2 (30);
      5    CommandText VARCHAR2 (4000);
      6  BEGIN
      7    usrLoginID := SYS_CONTEXT ('USERENV', 'CURRENT_USER');
      8 
      9    CommandText :=
    10    'SELECT      DISTINCT
    11             l.loginid,
    12             b.businesssegmentname
    13       FROM      scott.assignments_tb a,
    14             scott.logins_tb      l,
    15             scott.bussegment_tb  b
    16       WHERE      a.fk_login_no = l.login_no
    17       AND      a.fk_bussegid = b.bussegid
    18       AND      (l.loginid = ''' || usrLoginID || ''')
    19       ORDER BY b.businesssegmentname';
    20 
    21    OPEN p_weak_ref_cursor FOR CommandText;
    22  END test_procedure;
    23  /
    Procedure created.
    SQL> SHOW ERRORS
    No errors.
    SQL> VARIABLE g_ref REFCURSOR
    SQL> EXECUTE test_procedure (:g_ref)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    LOGINID                        BUSINESSSEGMENTNAME                             
    SCOTT                          SCOTT bussegname                                
    SQL>
    SQL>
    SQL> CREATE OR REPLACE PROCEDURE test_procedure
      2    (p_weak_ref_cursor OUT types_pkg.weak_ref_cursor_type)
      3  AS
      4    usrLoginID  VARCHAR2 (30);
      5    CommandText VARCHAR2 (4000);
      6  BEGIN
      7    usrLoginID := SYS_CONTEXT ('USERENV', 'CURRENT_USER');
      8 
      9    CommandText :=
    10    'SELECT      DISTINCT
    11             l.loginid,
    12             b.businesssegmentname
    13       FROM      scott.assignments_tb a,
    14             scott.logins_tb      l,
    15             scott.bussegment_tb  b
    16       WHERE      a.fk_login_no = l.login_no
    17       AND      a.fk_bussegid = b.bussegid
    18       AND      (l.loginid = :usrLoginID)
    19       ORDER BY b.businesssegmentname';
    20 
    21    OPEN p_weak_ref_cursor FOR CommandText USING usrLoginID;
    22  END test_procedure;
    23  /
    Procedure created.
    SQL> SHOW ERRORS
    No errors.
    SQL> VARIABLE g_ref REFCURSOR
    SQL> EXECUTE test_procedure (:g_ref)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    LOGINID                        BUSINESSSEGMENTNAME                             
    SCOTT                          SCOTT bussegname                                
    SQL>
    SQL>
    SQL> CREATE OR REPLACE PROCEDURE test_procedure
      2    (p_weak_ref_cursor OUT types_pkg.weak_ref_cursor_type,
      3       usrLoginID       IN  VARCHAR2)
      4  AS
      5    CommandText VARCHAR2 (4000);
      6  BEGIN
      7    CommandText :=
      8    'SELECT      DISTINCT
      9             l.loginid,
    10             b.businesssegmentname
    11       FROM      scott.assignments_tb a,
    12             scott.logins_tb      l,
    13             scott.bussegment_tb  b
    14       WHERE      a.fk_login_no = l.login_no
    15       AND      a.fk_bussegid = b.bussegid
    16       AND      (l.loginid = :usrLoginID)
    17       ORDER BY b.businesssegmentname';
    18 
    19    OPEN p_weak_ref_cursor FOR CommandText USING usrLoginID;
    20  END test_procedure;
    21  /
    Procedure created.
    SQL> SHOW ERRORS
    No errors.
    SQL> VARIABLE g_ref REFCURSOR
    SQL> VARIABLE usrLoginID VARCHAR2(30)
    SQL> EXECUTE :usrLoginID := SYS_CONTEXT ('USERENV', 'CURRENT_USER')
    PL/SQL procedure successfully completed.
    SQL> EXECUTE test_procedure (:g_ref, :usrLoginID)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    LOGINID                        BUSINESSSEGMENTNAME                             
    SCOTT                          SCOTT bussegname                                

  • ORA-06502: PL/SQL: numeric or value error(Run Time Error)

    Hi,
    Intially the table structure goes something like this.
    CREATE TABLE CLARITY_RESPONSE_LOG
      REQUEST_CODE   NUMBER,
      RESPONSE_FILE  BLOB,
      DATE_CRATED    DATE                           NOT NULL,
      CREATED_BY     NUMBER                         NOT NULL,
      UPDATED_BY     NUMBER                         DEFAULT 1,
    )The content of the RESPONSE_FILE column which is a BLOB data type has some XML content(XML file).
    The compiled proc which uses the above table is as follows.
    CREATE OR REPLACE PROCEDURE "MWF_ONLINE_RESPONSE_XML"
    AS
       v_file            UTL_FILE.FILE_TYPE;
       v_text            VARCHAR2 (20);
       v_filename        VARCHAR2 (200);
       v_delimitedchar   CHAR (1);
    ----log
      v_process_name  VARCHAR2(100) := 'MWF_ONLINE_RESPONSE_XML';
      v_sqlerrorcd          VARCHAR2(10);
      v_sqlerrormsg         VARCHAR2(255);
      v_seq_auto_email_job  NUMBER;
      v_cnt                 NUMBER := 0;
      v_user_name    VARCHAR2(30);
    BEGIN
      --- for log use
      SELECT sys_context('USERENV','OS_USER') INTO  v_user_name  FROM dual;
      INSERT INTO PROCESS_ERROR_LOG
                 (seq_num,
                  process_name,
                  status,
                  process_date,
                  user_name)
      VALUES     (seq_dataxprocesslog.NEXTVAL,
                  v_process_name,
                  'STA',
                  SYSDATE,
                  v_user_name);
       v_delimitedchar := CHR (124);
       v_filename := 'online_response_xml.txt';
       v_file := UTL_FILE.FOPEN ('MWF_DATA_EXTRACTS', v_filename, 'W');
       UTL_FILE.PUT_LINE
         (v_file,
           'online_response_xml'
       FOR online_response IN
          (SELECT XMLTYPE (response_file, NLS_CHARSET_ID ('char_cs')).getclobval () AS Online_Respone_xml
          FROM CLARITY_RESPONSE_LOG
          WHERE TRUNC(date_crated ) = TRUNC(SYSDATE-1)
          LOOP
          UTL_FILE.PUT_LINE (v_file, online_response.Online_Respone_xml);
        v_cnt := v_cnt + 1;
      END LOOP;
      UTL_FILE.FCLOSE(v_file);
      INSERT INTO PROCESS_ERROR_LOG
                 (seq_num,
                  process_name,
                  status,
                  process_date,
                  cnt,
                  user_name)
      VALUES     (seq_dataxprocesslog.NEXTVAL,
                  v_process_name,
                  'COM',
                  SYSDATE,
                  v_cnt,
                  v_user_name);
      COMMIT;
    EXCEPTION
      WHEN OTHERS THEN
        v_sqlerrorcd := SQLCODE;
        v_sqlerrormsg := SUBSTR(SQLERRM,1,255);
        INSERT INTO PROCESS_ERROR_LOG
                   (seq_num,
                    process_name,
                    status,
                    process_date,
                    error_msg,
                    error_id,
                    user_name)
        VALUES     (seq_dataxprocesslog.NEXTVAL,
                    v_process_name,
                    'ERR',
                    SYSDATE,
                    v_sqlerrormsg,
                    v_sqlerrorcd,
                    v_user_name);
        COMMIT;
    END;The above code has been compiled without any compilation errors but at run time I am getting the error:
    ORA-06502: PL/SQL: numeric or value error.
    Is it because of below statement in the above proc:
    SELECT XMLTYPE (response_file, NLS_CHARSET_ID ('char_cs')).getclobval () AS Online_Respone_xml
          FROM CLARITY_RESPONSE_LOG
          WHERE TRUNC(date_crated ) = TRUNC(SYSDATE-1)Please advice

    vine wrote:
    Is it because of below statement in the above proc:
    SELECT XMLTYPE (response_file, NLS_CHARSET_ID ('char_cs')).getclobval () AS Online_Respone_xml
    FROM CLARITY_RESPONSE_LOG
    WHERE TRUNC(date_crated ) = TRUNC(SYSDATE-1)Please adviceto see where the line code that gets the error try using dbms_output.put_line() and before you run your procedure use the SQL*Plus command set serveroutput on. see this example below using the dbms_output.put_line().
    CREATE OR REPLACE PROCEDURE "MWF_ONLINE_RESPONSE_XML" AS
       v_file            UTL_FILE.FILE_TYPE;
       v_text            VARCHAR2 (20);
       v_filename        VARCHAR2 (200);
       v_delimitedchar   CHAR (1);
    ----log
      v_process_name  VARCHAR2(100) := 'MWF_ONLINE_RESPONSE_XML';
      v_sqlerrorcd          VARCHAR2(10);
      v_sqlerrormsg         VARCHAR2(255);
      v_seq_auto_email_job  NUMBER;
      v_cnt                 NUMBER := 0;
      v_user_name    VARCHAR2(30);
    BEGIN
      --- for log use
      SELECT sys_context('USERENV','OS_USER') INTO  v_user_name  FROM dual;
    dbms_output.put_line('1');
      INSERT INTO PROCESS_ERROR_LOG
                 (seq_num,
                  process_name,
                  status,
                  process_date,
                  user_name)
      VALUES     (seq_dataxprocesslog.NEXTVAL,
                  v_process_name,
                  'STA',
                  SYSDATE,
                  v_user_name);
    dbms_output.put_line('2');
       v_delimitedchar := CHR (124);
       v_filename := 'online_response_xml.txt';
       v_file := UTL_FILE.FOPEN ('MWF_DATA_EXTRACTS', v_filename, 'W');
       UTL_FILE.PUT_LINE(v_file,'online_response_xml');
    dbms_output.put_line('3');
       FOR online_response IN
          (SELECT XMLTYPE (response_file, NLS_CHARSET_ID ('char_cs')).getclobval () AS Online_Respone_xml
             FROM CLARITY_RESPONSE_LOG
            WHERE TRUNC(date_crated ) = TRUNC(SYSDATE-1)) LOOP
          UTL_FILE.PUT_LINE (v_file, online_response.Online_Respone_xml);                                                  
          v_cnt := v_cnt + 1;
    dbms_output.put_line('4');
       END LOOP;
      UTL_FILE.FCLOSE(v_file);
    dbms_output.put_line('5');
      INSERT INTO PROCESS_ERROR_LOG
                 (seq_num,
                  process_name,
                  status,
                  process_date,
                  cnt,
                  user_name)
      VALUES     (seq_dataxprocesslog.NEXTVAL,
                  v_process_name,
                  'COM',
                  SYSDATE,
                  v_cnt,
                  v_user_name);
      COMMIT;
    dbms_output.put_line('6');
    EXCEPTION
      WHEN OTHERS THEN
        v_sqlerrorcd := SQLCODE;
        v_sqlerrormsg := SUBSTR(SQLERRM,1,255);
        INSERT INTO PROCESS_ERROR_LOG
                   (seq_num,
                    process_name,
                    status,
                    process_date,
                    error_msg,
                    error_id,
                    user_name)
        VALUES     (seq_dataxprocesslog.NEXTVAL,
                    v_process_name,
                    'ERR',
                    SYSDATE,
                    v_sqlerrormsg,
                    v_sqlerrorcd,
                    v_user_name);
        COMMIT; 
    END;

  • Upgrade to APEX 4.2.3 apexins_con.sql gets: catconInit: database is not open Unexpected error encountered in catconInit; exiting

    Upgrade to APEX 4.2.3 apexins_con.sql gets Unexpected error encountered in catconInit; exiting
    I am attempting to install/upgrade apex 4.2.3 under Oracle12c in a Multi-Tenant configuration.
    Here are the environmental details
    Windows 7 64 bit
    Apex 4.2.3
    ORCL: CDB$ROOT
    PDBORCL: PDB$SEED
    Here is the current states of the pluggable databases
    SQL> SELECT NAME,OPEN_MODE,TOTAL_SIZE/1024/1024/1024 FROM V$PDBS;
    NAME                           OPEN_MODE  TOTAL_SIZE/1024/1024/1024
    PDB$SEED                       READ ONLY                 .263671875
    PDBORCL                        READ WRITE                .366210938
    SQL>
    This is the command that I am using to re-install/upgrade APEX:
    # remove 4.2.2 installation
    cd M:\apex_4.2.3\apex_4.2.3_en\apex
    sqlplus /@ORCL as sysdba
    @apxremov.sql   <<  this was successful
    quit
    Install 4.2.3 installation
    sqlplus /@ORCL as sysdba
    @apexins_con.sql i10wrk SYSAUX SYSAUX TEMP /i/  << this failed
    The APEX  installation fails immediately with the following message:
    catconInit: database is not open
    Unexpected error encountered in catconInit; exiting
    I cannot determine which database is not open.  Both my CDB$ROOT and PDBORCL are reported as open (READ WRITE Mode).
    Here is my Container database
    SQL>  SELECT SYS_CONTEXT ('USERENV', 'CON_NAME') FROM DUAL;
    SYS_CONTEXT('USERENV','CON_NAME')
    CDB$ROOT
    SQL> select instance_name,status from v$instance;
    INSTANCE_NAME    STATUS
    orcl             OPEN
    SQL>
    Here is the associated Pluggable Database
    sqlplus /@PDBORCL as sysdba
    SQL> select instance_name,status from v$instance;
    INSTANCE_NAME    STATUS
    orcl             OPEN
    SQL> ALTER PLUGGABLE DATABASE PDBORCL OPEN;
    ALTER PLUGGABLE DATABASE PDBORCL OPEN
    ERROR at line 1:
    ORA-65019: pluggable database PDBORCL already open
    I am confused…. Which database is not open?
    The PDB$SEED is open in (READ ONLY) mode, but that is simply the template database.  I don't think that ever needs to be open in (Read Write) mode.

    sbing52,
    I cannot vouch for the specific error that is being returned by catcon.pl, but I would try the following in your situation.
    1. It seems you connect to CDB$ROOT and ran apxremov.sql. This only removed the common APEX option from CDB$ROOT. Your PDB is now in an inconsistent state, since APEX is no longer in the root. I would reconnect to CDB$ROOT and run apxremov_con.sql, make sure you use the one from the 4.2.3 distribution. The one in the ORACLE home will not work.
    2. I would then re-run apexins_con.sql connect to CDB$ROOT. Also, you need to pass the proper parameters. Why are you passing i10wrk? You should be invoking it like:
    @apexins_con.sql SYSAUX SYSAUX TEMP /i/
    Regards,
    Jason

  • Getting error ORA-01732, after implementation of VPD policy

    Hi,
    I have created a policy to restrcit the number of records affected in auncondtional select & update (not more than 3 at a time). The policy is working fine for the select staement but when I'm trying to update the same table I'm getting "ORA-01372: data manipulation operation not legal on this view".
    I'm using Oracle 10g release 2. & I performed following steps:
    SQL> connect SYS as SYSDBA
    Enter password: ****************
    Connected.
    SQL> GRANT EXECUTE ON DBMS_SESSION TO smbdev;
    Grant succeeded.
    SQL> GRANT EXECUTE ON DBMS_RLS TO smbdev;
    Grant succeeded.
    SQL> GRANT CREATE ANY CONTEXT to smbdev;
    Grant succeeded.
    SQL> GRANT create trigger to smbdev;
    Grant succeeded.
    SQL> GRANT ADMINISTER DATABASE TRIGGER to smbdev;
    Grant succeeded.
    SQL> connect smbdev@SMBS
    Enter password: *******
    Connected.
    SQL> CREATE OR REPLACE CONTEXT rownum_ctx USING rownum_ctx_pkg;
    Context created.
    SQL> CREATE OR REPLACE PACKAGE rownum_ctx_pkg IS
    2 PROCEDURE set_rownum;
    3 END;
    4 /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY rownum_ctx_pkg IS
    2 PROCEDURE set_rownum
    3 AS
    4 BEGIN
    5 DBMS_SESSION.SET_CONTEXT('rownum_ctx', 'rownum', 4);
    6 EXCEPTION
    7 WHEN NO_DATA_FOUND THEN NULL;
    8 END set_rownum;
    9 END;
    10 /
    Package body created.
    SQL> CREATE OR REPLACE TRIGGER set_rownum_ctx_trig AFTER LOGON ON DATABASE
    2 BEGIN
    3 smbdev.rownum_ctx_pkg.set_rownum;
    4 END;
    5 /
    Trigger created.
    SQL> CREATE OR REPLACE FUNCTION get_rownum(
    2 schema_p IN VARCHAR2,
    3 table_p IN VARCHAR2)
    4 RETURN VARCHAR2
    5 AS
    6 rownum_pred VARCHAR2 (400);
    7 BEGIN
    8 rownum_pred := 'rownum < SYS_CONTEXT(''rownum_ctx'', ''rownum'')';
    9 RETURN rownum_pred;
    10 END;
    11 /
    Function created.
    SQL> BEGIN
    2 DBMS_RLS.ADD_POLICY (
    3 object_schema => 'smbdev',
    4 object_name => 'SMB_BOLT_CODE',
    5 policy_name => 'rownum_policy',
    6 function_schema => 'smbdev',
    7 policy_function => 'get_rownum',
    8 statement_types => 'select,update’)
    9 END;
    10 /
    PL/SQL procedure successfully completed.
    SQL> select * from smbdev.SMB_BOLT_CODES;
    CATENTRY_ID SYN_BOLT_CODE
    13700 08000026540000
    13701 08000026520000
    13702 08000026530000
    SQL> update smb_bolt_codes set SYN_BOLT_CODE='asd';
    update smb_bolt_codes set SYN_BOLT_CODE='asd'
    ERROR at line 1:
    ORA-01732: data manipulation operation not legal on this view
    SQL> select * from tab where tname=’ SMB_BOLT_CODES’;
    TNAME TABTYPE CLUSTERID
    SMB_BOLT_CODES TABLE
    SQL> connect sys@smbs as SYSDBA
    Enter password: ***********
    Connected.
    SQL> select count(*) from smbdev.SMB_BOLT_CODES;
    COUNT(*)
    101
    Please let me know what I'm doing wrong or what I need to change?
    Thanks in advance.

    Welcome to the forum!
    This seems odd: you add a policy to an object named SMB_BOLT_CODE, but you query SMB_BOLT_CODES
    SQL> BEGIN
    2 DBMS_RLS.ADD_POLICY (
    3 object_schema => 'smbdev',
    4 object_name => 'SMB_BOLT_CODE',
    5 policy_name => 'rownum_policy',
    6 function_schema => 'smbdev',
    7 policy_function => 'get_rownum',
    8 statement_types => 'select,update’)
    9 END;
    10 /
    PL/SQL procedure successfully completed.
    SQL> select * from smbdev.SMB_BOLT_CODES; --<------ Notice the extra S here...Edited by: Alex Nuijten on Aug 14, 2009 2:28 PM

  • Exact fetch returns more than requested number of rows oracle error ; unable to find where exactly throwing error in the below code.

    hi i am receiving "exact fetch returns more than requested number of rows oracle error". but i am not able to locate the error in the below code. Any help would be appreciated!!!
    CREATE OR REPLACE PROCEDURE load_scene_collection_item (
    --pdname                                  VARCHAR2,
    -- LOCATION TO ADD/CHANGE below!!!
    pITEM_TYPE_ID                      INTEGER,
    pSCENE_COLLECTION_ID        INTEGER,
    pCOLLECTION_ITEM_NAME     VARCHAR2,
    pCOLLECTION_ITEM_DESC      VARCHAR2,
    pDEFAULT_COORD_X      NUMBER,
    pDEFAULT_COORD_Y      NUMBER,
    pDEFAULT_COORD_Z      NUMBER,
    pDEFAULT_WIDTH            NUMBER,
    pDEFAULT_HEIGHT            NUMBER,
    pDEFAULT_ROTATION      INTEGER,
    pDEFAULT_ALPHA            INTEGER,
    pfname                                 VARCHAR2)    IS
    src_file BFILE;
    dst_file BLOB;
    lgh_file BINARY_INTEGER;
    BEGIN
    src_file := bfilename('BUSINESSBLOBSIMAGES', pfname);
    -- insert a NULL record to lock
    Insert into SCENE_COLLECTION_ITEM
       ( ITEM_TYPE_ID,
       SCENE_COLLECTION_ID,
       COLLECTION_ITEM_NAME,
       COLLECTION_ITEM_DESC,
        COLLECTION_ITEM_IMAGE,
       DEFAULT_COORD_X,
       DEFAULT_COORD_Y,
       DEFAULT_COORD_Z,
       DEFAULT_WIDTH,
       DEFAULT_HEIGHT,
       DEFAULT_ROTATION,
       DEFAULT_ALPHA,
        CREATE_USER,
        CREATE_DATE)
    Values    ( pITEM_TYPE_ID, pSCENE_COLLECTION_ID, pCOLLECTION_ITEM_NAME, pCOLLECTION_ITEM_DESC, EMPTY_BLOB(),   
       pDEFAULT_COORD_X,
       pDEFAULT_COORD_Y,
       pDEFAULT_COORD_Z,
       pDEFAULT_WIDTH,
       pDEFAULT_HEIGHT,
       pDEFAULT_ROTATION,
       pDEFAULT_ALPHA,  
    sys_context('USERENV', 'OS_USER'), 
    sys_extract_utc(systimestamp))
    RETURNING COLLECTION_ITEM_IMAGE INTO dst_file;
    -- LOCATIONs(2) TO ADD/CHANGE above!!!
    -- lock record
    SELECT COLLECTION_ITEM_IMAGE
    INTO dst_file
    FROM SCENE_COLLECTION_ITEM
    WHERE ITEM_TYPE_ID     = pITEM_TYPE_ID
    AND SCENE_COLLECTION_ID = pSCENE_COLLECTION_ID
    AND COLLECTION_ITEM_NAME= pCOLLECTION_ITEM_NAME
    AND COLLECTION_ITEM_DESC= pCOLLECTION_ITEM_DESC
    AND    pDEFAULT_COORD_X = DEFAULT_COORD_X
    AND   pDEFAULT_COORD_Y  = DEFAULT_COORD_Y
    AND   pDEFAULT_COORD_Z  = DEFAULT_COORD_Z
    AND   pDEFAULT_WIDTH    = DEFAULT_WIDTH
    AND   pDEFAULT_HEIGHT   = DEFAULT_HEIGHT
    AND   pDEFAULT_ROTATION = DEFAULT_ROTATION
    AND   pDEFAULT_ALPHA    = DEFAULT_ALPHA
    FOR UPDATE;
    -- LOCATION TO ADD/CHANGE above!!!
    -- open the file
    dbms_lob.fileopen(src_file, dbms_lob.file_readonly);
    -- determine length
    lgh_file := dbms_lob.getlength(src_file);
    -- read the file
    dbms_lob.loadfromfile(dst_file, src_file, lgh_file);
    -- update the blob field
    UPDATE SCENE_COLLECTION_ITEM
    SET COLLECTION_ITEM_IMAGE = dst_file
    WHERE ITEM_TYPE_ID     = pITEM_TYPE_ID
    AND SCENE_COLLECTION_ID = pSCENE_COLLECTION_ID
    AND COLLECTION_ITEM_NAME= pCOLLECTION_ITEM_NAME
    AND COLLECTION_ITEM_DESC= pCOLLECTION_ITEM_DESC
    AND    pDEFAULT_COORD_X = DEFAULT_COORD_X
    AND   pDEFAULT_COORD_Y  = DEFAULT_COORD_Y
    AND   pDEFAULT_COORD_Z  = DEFAULT_COORD_Z
    AND   pDEFAULT_WIDTH    = DEFAULT_WIDTH
    AND   pDEFAULT_HEIGHT   = DEFAULT_HEIGHT
    AND   pDEFAULT_ROTATION = DEFAULT_ROTATION
    AND   pDEFAULT_ALPHA    = DEFAULT_ALPHA
    -- LOCATION TO ADD/CHANGE above!!!
    -- close file
    dbms_lob.fileclose(src_file);
    END load_scene_collection_item;
    Thanks in advance!!!!

    Hi PaulHorth,
    Thanks for the quick reply.
    Actually, i am getting  error while updating the records.
    below is the error message:
    Error starting at line 1 in command:
    exec load_scene_collection_item(3,15,'2 Lane 4way Stop','4 Way Stop Intersection with 2 lanes in each direction',0,0,0,400,517,0,1,'2 Lane 4way Stop.PNG');
    Error report:
    ORA-01422: exact fetch returns more than requested number of rows
    ORA-06512: at "DP_OWNER.LOAD_SCENE_COLLECTION_ITEM", line 55
    ORA-06512: at line 1
    01422. 00000 - "exact fetch returns more than requested number of rows"
    *Cause:    The number specified in exact fetch is less than the rows returned.
    *Action:   Rewrite the query or change number of rows requested

Maybe you are looking for

  • ISight cam is getting crazy?

    Hi, I installed xmeeting 0.3.4 (H.323 videoconferencing client) on my iMac. xmeeting is showing me this camera picture: http://www.highsider.de/test/xmeeting.jpg Note - the picture seems to be distorted and squeezed or have a filter applied like in P

  • Display a transparent image in JPanel

    i just start using Java Graphics Programming fews month ago. there's some problem i facing recently. i doing a simple gif file viewer. first i get the file using the Toolkit and put it in a Image object and use the Gif Decoder to decoded each frame o

  • Captions in Mobileme

    I'm stumped. How do I have captions applied in Aperture show up in a MobileMe slideshow?

  • Html5 video doesn't play

    I was on the People magazine site and where there was supposed to be a video it said this player cannot play HTML video. I thought iOS can't play Flash video but that HTML 5 is what apple supports. Am I wrong?

  • When uploading pics on eBay, they show as blanks can someone help? Thanks

    Listing an item for sale on eBay, when trying to upload pics they come up as blanks, hasn't happened before. woder what the problem might be?