Query running OK in SQL, giving error in form trigger.

Hi guys,
i am in a strange situation. I have a table.
EMP_SCALES with fields and datatype.
PAY_SCALE BASIC_SAL
VI 8000
VI-1 10000
Now when on SQL PROMPT i try to find out BASIC_SAL in the table EMP_SCALES i am writing this query and its working.
SQL>select basic_sal from emp_scales where pay_scale like('%VI-1%');
Now i have to use the same query in when-button-press event of a button in my form.
Code:
DECLARE
basic_sal_emp number;
curr_emp_scale := :BLOCK.MYFIELD;
BEGIN
SELECT BASIC_SAL
INTO BASIC_SAL_EMP
FROM EMP_SCALES
WHERE PAY_SCALE LIKE ('%curr_emp_scale%');          
END;
(Where :BLOCK.MYFIELD consist EMP_SCALE and its datatype is also char)
this query retrieves no record... and gives error.
ORA-01403 which says..
Cause: In a host language program, all records have been fetched. The return code from the fetch was +4, indicating that all records have been returned from the SQL query.
Action: Terminate processing for the SELECT statement
HOW CAN I RESOLVE MY PROBLEM?????
Plis help
Imran Baig

Dur. Everyone seems to have overlooked the import of the error message: ORA-01422. This is thrown whenever an exact fetch returns more than one row.
The code works when the value 'VI-1' is hard-coded because there's only one row like that. However, when a field is used the query is obviously returning more than one row. For instance, if :EMP_INCREMENTS.CUR_SCALE is empty (NULL) then the query will return all rows (which is more than one). The same applies if the field has a value of 'VI'.
If you want to use INTO then the query must either return exactly one row or else the trigger needs to handle multiple returns.
Cheets, APC

Similar Messages

  • Query running ok in SQL but giving error in form trigger

    Hi guys
    here is the query
    SELECT NVL(BGM_PERAMT,0) INTO PERAMT FROM BROKERAGE_MASTER
    WHERE     BGM_BROKERAGETYPE = 'BR01' AND BGM_PERAMT <> 0
    The above query working fine in SQL but giving following error in when_button_pressed trigger
    [In a host language program, all records have been fetched. The return code from the fetch was +4 indicating that all records have been returned from the SQL query. ]
    please give me the solution for this problem.
    It is very urgent
    regards
    asha

    ok below is the code
    CURSOR RESALE_BROKERAGE IS SELECT am_brokerCd resalebrcd,'' resalesbrcd,NVL(SUM(AM_AMT),0) RESALE_AMT,COUNT(AM_RESALENO) TOTCNT,NVL(SUM(AM_UNITSAPPLD),0) RESALE_UNITS
    FROMRNT_RESALE_MASTER
    WHERE am_brokercd is not null AND AM_PROCTAG='Y' AND
    (to_date(to_char(AM_PROCDT,'DD/MON/YYYY')) BETWEEN
    to_date(to_char(:rnt_broker_date.fromdt,'DD/MON/YYYY')) AND
    to_date(to_char(:rnt_broker_date.todate,'DD/MON/YYYY')))
    GROUP BY am_brokerCd
    UNION
    SELECT AM_BROKERCD resalebrcd,     
    am_subbrokercd resalesbrcd,
    NVL(SUM(AM_AMT),0) RESALE_AMT,COUNT(AM_RESALENO) TOTCNT,
    NVL(SUM(AM_UNITSAPPLD),0) RESALE_UNITS
    FROM RNT_RESALE_MASTER
    WHERE     am_brokercd is not null AND AM_PROCTAG='Y' AND AM_BROKERCD = 'ARN-9760' AND (to_date(to_charAM_PROCDT,'DD/MON/YYYY')) BETWEEN
    to_date(to_char(:rnt_broker_date.fromdt,'DD/MON/YYYY')) AND
    to_date(to_char(:rnt_broker_date.todate,'DD/MON/YYYY')))
    GROUP BY AM_BROKERCD,am_subbrokercd;
    Asha

  • XdbConfiguration.sql giving errors for package XDB_CONFIGURATION

    Hi,
    I am getting following errors(at the bottom) while running xdbConfiguration.sql before installing the demo.
    I am logged in as sys user(sysdba) and using running
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.1.0 - Production
    on Windows2000.
    Is the wrong version of Oracle. Do I have have 9.2.4.0.
    Thanks in advance for help.
    Om Soni
    Errors for PACKAGE BODY XDB_CONFIGURATION:
    LINE/COL ERROR
    51/6 PL/SQL: Statement ignored
    51/54 PLS-00302: component 'DELETE_FORCE' must be declared
    56/4 PL/SQL: SQL Statement ignored
    56/20 PL/SQL: ORA-22970: name does not correspond to an object view

    Hi ,
    I upgraded to 9.2.0.4.0. The error still shows up while running the xdbConfiguration.sql.
    The following errors show up:
    Errors for PACKAGE BODY XDB_CONFIGURATION:
    LINE/COL ERROR
    51/6 PL/SQL: Statement ignored
    51/54 PLS-00302: component 'DELETE_FORCE' must be declared
    56/4 PL/SQL: SQL Statement ignored
    58/9 PL/SQL: ORA-00942: table or view does not exist
    I got rid of first two error by removing dbms_xdb.DELETE_FORCE from line
    dbms_xdb.deleteResource(targetResource,dbms_xdb.DELETE_FORCE);
    Last two error are at line :
    select make_ref(DATABASE_SUMMARY,'DATABASE_SUMMARY')
    into xmlref
    from DATABASE_SUMMARY;
    Looking at the script DATABASE_SUMMARY is not a object.
    May be the script has a bug in it.
    -Om

  • Webutil form  giving error "oracle.forms.webutil.* bean not found.

    i have done all settings as per given in documentation of webutil.
    forms is compiling but at runtime it gives error:
    oracle.forms.webutil.clientinfo.getclientinfo bean not found.
    what could be the reason.plz. help.
    shikha...

    Hi Shika,
    Probably, the issue could be because of any one of the following.
    <br>
    <br>
    1. Check whether you have added $OARCLE_HOME\forms90\java\frmwebutil.jar in the default.env under $ORACLE_HOME\Forms90\server folder.
    <br>
    <br>
    2. Check whether you have added the virtual directory
    <virtual-directory virtual-path="/webutil" real-path="$OARCLE_HOME/forms90/webutil" />
    in the file orion-web.xml under $ORACLE_HOME\j2ee\DevSuite\application-deployments\forms\forms90web folder
    <b<i>Correctly</i></b>
    <br>
    <br>
    HTH.
    <br>
    Regards,
    <br>
    Arun

  • Dynamic Sql giving error

    Hi,
    I am creating a BIP report and it is giving an issue on generating Data XML in OTM application.
    The Report XML is simple query and taking input parameter for shipment_gid, the parameter is handled in SET_LEXICAL_PARAMETER to add where clause and append “=” with the passed value of parameter &P_SHIPMENT_GGID.
    When I try to generate data XML in Query template, it is giving below error
    java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended
    I have tried to change parameter in many ways in SET_LEXICAL_PARAMETERS, but still getting error. Please check the XML and package and advice.
    XML
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <dataTemplate name="pri_sec_ocean_fcl_booking_view" defaultPackage="pri_sec_ocean_fcl_booking_view" version="1.0">
    <properties>
    <property name="xml_tag_case" value="upper" />
    </properties>
    <parameters>
    <parameter name="P_GL_USER" dataType="character" defaultValue="ULE.ADMIN" />
    <parameter name="P_ROLE_ID" dataType="character" defaultValue="ADMIN" />
    <parameter name="P_L_SHIPMENT_GGID" dataType="character" defaultValue="1=1" />
    </parameters>
    <lexicals />
    <dataQuery>
    <sqlStatement name="Q_1">
    <![CDATA[SELECT
                             CT.FIRST_NAME||' '||CT.LAST_NAME||' Email '||CT.EMAIL_ADDRESS||'PHONE1 '||CT.PHONE1||'PHONE2 '||CT.PHONE2 BOOKER_ID
                   FROM      SHIPMENT_INVOLVED_PARTY SH,
                             CONTACT CT
                             &P_L_SHIPMENT_GGID
                   AND        SH.INVOLVED_PARTY_QUAL_GID               =     'CARRIER_BOOKING_OFFICE'
                   AND          SH.INVOLVED_PARTY_CONTACT_GID          =     CT.CONTACT_GID
       ]]>
    </sqlStatement>
    </dataQuery>
    <dataTrigger name="afterParameterFormTrigger" source="pri_sec_ocean_fcl_booking_view.afterpform" />
    <dataTrigger name="beforeReportTrigger" source="pri_sec_ocean_fcl_booking_view.beforereport" />
    <dataStructure>
    <element name="P_L_SHIPMENT_GGID" dataType="varchar2" value="pri_sec_ocean_fcl_booking_view.P_L_SHIPMENT_GGID" />
    <group name="G_1" dataType="varchar2" source="Q_1">
    <element name="BOOKER_ID" dataType="varchar2" value="BOOKER_ID"/>
    </group>
    </dataStructure>
    <dataTrigger name="afterReportTrigger" source="pri_sec_ocean_fcl_booking_view.afterreport()" />
    </dataTemplate>
    Package
    create or replace PACKAGE pri_sec_ocean_fcl_booking_view IS
    DESNAME VARCHAR2(200);
    DESTYPE VARCHAR2(100);
    DESFORMAT VARCHAR2(200):='PDF';
    P_GL_USER VARCHAR2(128);
    P_ROLE_ID VARCHAR2(1000);
    P_DATABASE_CONN_STRING VARCHAR2(50);
    P_FILE VARCHAR2(100);
    P_PDF_HYPERLINK VARCHAR2(1000);
    P_REPORT_GID VARCHAR2(101);
    P_XML_HYPERLINK VARCHAR2(1000);
    P_DOMAIN VARCHAR2(50);
    P_KEEP_FILE_FLAG VARCHAR2(1);
    P_LANGUAGE_ID VARCHAR2(30);
    P_RPT_JOB NUMBER;
    P_FORMAT VARCHAR2(40);
    P_DATE_FORMAT VARCHAR2(15);
    P_TIME_FORMAT VARCHAR2(32767);
    P_REPORT_CALL VARCHAR2(1000);
    P_GLOG_USER VARCHAR2(30);
    P_GLOG_USER_PASS VARCHAR2(30);
    P_REPORT_PHYSICAL_NAME VARCHAR2(100) := 'PRI_SEC_OCEAN_FCL_BOOKING_VIEW';
    P_WITHIN_REPORT VARCHAR2(1);
    P_REPORTS_OUT_DIR VARCHAR2(100);
    P_REPORTS_SERVER VARCHAR2(100);
    P_SHIP_START_RANGE DATE;
    P_SHIP_END_RANGE DATE;
    P_GROUP_BY VARCHAR2(2000);
    P_REP_USERID VARCHAR2(100);
    P_L_SHIPMENT_GGID VARCHAR2(32766) := '1=1';
    P_L_CONTAINER_NUMBER_WHERE VARCHAR2(32766) := '1=1';
    P_H_CONTAINER_NUMBER VARCHAR2(32766);
    FUNCTION P_FORMATVALIDTRIGGER(DESTYPE IN VARCHAR2) RETURN BOOLEAN;
    FUNCTION BEFOREREPORT RETURN BOOLEAN;
    FUNCTION AFTERREPORT RETURN BOOLEAN;
    FUNCTION BEFOREPFORM RETURN BOOLEAN;
    FUNCTION AFTERPFORM RETURN BOOLEAN;
    FUNCTION P_SHIP_END_RANGEVALIDTRIGGER RETURN BOOLEAN;
    FUNCTION VALUE_ENTERED(LEX_NAME IN VARCHAR2) RETURN BOOLEAN;
    PROCEDURE SET_LEXICAL_PARAMETERS;
    END PRI_SEC_OCEAN_FCL_BOOKING_VIEW;
    create or replace
    PACKAGE BODY PRI_SEC_OCEAN_FCL_BOOKING_VIEW IS
    FUNCTION P_FORMATVALIDTRIGGER(DESTYPE IN VARCHAR2) RETURN BOOLEAN IS
    BEGIN
    IF DESTYPE = 'Cache' AND P_WITHIN_REPORT = 'N' THEN
    IF P_FORMAT = 'View PDF' THEN
    DESFORMAT := 'PDF';
    ELSIF P_FORMAT = 'View HTML' THEN
    DESFORMAT := 'HTMLCSS';
    END IF;
    END IF;
    RETURN (TRUE);
    END P_FORMATVALIDTRIGGER;
    FUNCTION BEFOREREPORT RETURN BOOLEAN IS
    BEGIN
    REPORTS_LIBRARY.SET_VPD(P_GL_USER);
    /*SRW.SET_BEFORE_REPORT_HTML(SRW.TEXT_ESCAPE
    ,BUILD_HTML_HEADER)*/NULL;
    /*SRW.SET_AFTER_REPORT_HTML(SRW.TEXT_ESCAPE
    ,BUILD_HTML_FOOTER(P_REPORT_GID
    ,P_LANGUAGE_ID))*/NULL;
    RETURN (TRUE);
    END BEFOREREPORT;
    FUNCTION AFTERREPORT RETURN BOOLEAN IS
    BEGIN
    REPORTS_LIBRARY.SET_VPD(P_GL_USER);
    IF DESTYPE = 'File' THEN
    RPT_GENERAL.P_INSERT_LOG(P_FILE
    ,P_REPORT_GID
    ,P_RPT_JOB
    ,P_GL_USER
    ,P_DOMAIN);
    END IF;
    RETURN (TRUE);
    END AFTERREPORT;
    FUNCTION BEFOREPFORM RETURN BOOLEAN IS
    BEGIN
    REPORTS_LIBRARY.SET_VPD(P_GL_USER);
    /*SRW.SET_AFTER_FORM_HTML(SRW.TEXT_ESCAPE
    ,BUILD_AFTER_FORM_HTML)*/NULL;
    RETURN (TRUE);
    END BEFOREPFORM;
    FUNCTION AFTERPFORM RETURN BOOLEAN IS
    V_STRING VARCHAR2(32750);
    WS_DATE VARCHAR2(30);
    V_BOOLEAN BOOLEAN;
    BEGIN
    REPORTS_LIBRARY.SET_VPD(P_GL_USER);
    V_BOOLEAN := REPORTS_LIBRARY.GET_USER_PREFERENCES(P_GL_USER,P_ROLE_ID
    ,P_DATE_FORMAT
    ,P_TIME_FORMAT
    ,P_LANGUAGE_ID);
    V_STRING := RTRIM(REPORTS_LIBRARY.BUILD_LOCALIZATION_STRING(P_REPORT_GID
    ,P_LANGUAGE_ID));
    /*SRW.APPLY_DEFINITION*/NULL;
    IF P_KEEP_FILE_FLAG = 'Y' THEN
    WS_DATE := '_' || TO_CHAR(SYSDATE
    ,'YYMMDDHHMI');
    END IF;
    P_FILE := LOWER(TRANSLATE(TRANSLATE(P_DOMAIN || '_' || P_REPORT_GID
    ,'_') || P_RPT_JOB || WS_DATE || '.' || DESFORMAT);
    DESNAME := LOWER(P_REPORTS_OUT_DIR || '/' || P_FILE);
    /*SRW.GET_REPORT_NAME(P_REPORT_PHYSICAL_NAME)*/NULL;
    P_REPORT_PHYSICAL_NAME := RTRIM(P_REPORT_PHYSICAL_NAME);
    P_PDF_HYPERLINK := P_REPORT_CALL || '?' || P_REP_USERID || ' server=' || P_REPORTS_SERVER || ' report=' || P_REPORT_PHYSICAL_NAME || ' destype=CACHE desformat=PDF p_gl_user=' || P_GL_USER || ' p_within_report=Y' || ' P_REPORT_GID=' || P_REPORT_GID || ' p_l_time_period=' || ' p_l_named_range=' || ' p_rep_userid=' || P_REP_USERID;
    P_XML_HYPERLINK := P_REPORT_CALL || '?' || P_REP_USERID || ' server=' || P_REPORTS_SERVER || ' report=' || P_REPORT_PHYSICAL_NAME || ' destype=CACHE desformat=XML p_gl_user=' || P_GL_USER || ' p_within_report=Y' || ' P_REPORT_GID=' || P_REPORT_GID || ' p_l_time_period=' || ' p_l_named_range=' ||' p_rep_userid=' || P_REP_USERID;
    SET_LEXICAL_PARAMETERS;
    RETURN (TRUE);
    END AFTERPFORM;
    FUNCTION P_SHIP_END_RANGEVALIDTRIGGER RETURN BOOLEAN IS
    BEGIN
    RETURN (TRUE);
    END P_SHIP_END_RANGEVALIDTRIGGER;
    FUNCTION VALUE_ENTERED(LEX_NAME IN VARCHAR2) RETURN BOOLEAN IS
    BEGIN
    IF LEX_NAME > ' ' AND LEX_NAME <> '1=1' AND LEX_NAME IS NOT NULL THEN
    RETURN (TRUE);
    ELSE
    RETURN (FALSE);
    END IF;
    END VALUE_ENTERED;
    PROCEDURE SET_LEXICAL_PARAMETERS IS
    PLS_ORIG_P1 VARCHAR2(32766);
    BEGIN
    P_L_SHIPMENT_GGID := REPLACE(P_L_SHIPMENT_GGID
    ,'~'
    IF VALUE_ENTERED(P_L_SHIPMENT_GGID) THEN
    P_L_SHIPMENT_GGID := 'WHERE SH.P_L_SHIPMENT_GGID ' || REPORTS_LIBRARY.GET_FILTER_CONDITION(P_L_SHIPMENT_GGID,NULL,'Y');
    ELSE
    P_L_SHIPMENT_GGID := '1=1';
    END IF;
    END SET_LEXICAL_PARAMETERS;
    END PRI_SEC_OCEAN_FCL_BOOKING_VIEW;
    Thanks,
    Dev

    Hi Dev,
    I am not aware that you could change the value of P_L_SHIPMENT_GGID this way.
    One quick way to test that will be to set it to default to something like 'where 1=2' in your concurrent program and see if it runs but produce no results.
    If it indeed does run, then it confirms my thinking.
    You can then do something like this;
    Try creating a global variable in your pri_sec_ocean_fcl_booking_view package header, say G_L_SHIPMENT_GGID.
    Calculate your lexical string and put it in G_L_SHIPMENT_GGID.
    Reference G_L_SHIPMENT_GGID in your query
    FROM SHIPMENT_INVOLVED_PARTY SH,
    CONTACT CT
    &G_L_SHIPMENT_GGID
    .......Kofi

  • Dynamic sql giving error --please help

    Hi ,
    I have written the following code --
    CREATE OR REPLACE FUNCTION tabcount (
    tab IN VARCHAR2, field IN VARCHAR2 ,whr IN VARCHAR2)
    RETURN INTEGER
    IS
    retval INTEGER;
    BEGIN
    DBMS_OUTPUT.PUT_LINE ('whr' ||whr);
    DBMS_OUTPUT.PUT_LINE ('field1' ||field);
    EXECUTE IMMEDIATE
    ' SELECT COUNT(*) FROM ' || tab ||
    ' WHERE ' || field || 'like '/'%'||whr ||'%'/''
    INTO retval;
    DBMS_OUTPUT.PUT_LINE ('countis!' ||retVal);
    RETURN retval;
    END tabcount;
    It is giving the following error--
    ORA-00920: invalid relational operator
    ORA-06512: at "TABCOUNT", line 10
    ORA-06512: at line 2
    I am not sure how to enclose the like operator within the single quotes.Double quotes is not working for me.
    Thanx in advance,
    Ira

    Offhand, it looks like you may still have some syntax problems -- probably need a blank space before the WHERE --maybe some other stuff too.
    What you need to do to debug it is this (and this works just about anytime you are having trouble with dynamic SQL):
    1. store the sql statement in a variable.
    2. Use DBMS_OUTPUT to display your select statement BEFORE calling execute immediate.
    3. copy/paste that select into a separate window and run/debug it.
    4. Once you know what is wrong with that statement, go back and fix the code accordingly.
    Have fun,
    --scott                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • RMI client running from different machine giving error

    HI all
    I am trying to run the sample application getStart hello world.
    I am able to run the java applet from the same machine ....
    but i am get error when i am trying run client applet from the different machine .
    (HelloApplet exception: access denied (java.net.SocketPermission)
    client applet on machine1 and server and registory on machine2 in same lan .
    i copied the Helloapplet.class and Helloclient.html to machine1.
    appletviewer Helloclient.html
    but the java version is different in both machines.......
    can any one give some idea ....
    the errror i am geting is :
    HelloApplet exception: access denied (java.net.SocketPermission Neind-ws-003 res
    olve)
    java.security.AccessControlException: access denied (java.net.SocketPermission N
    eind-ws-003 resolve)
    at java.security.AccessControlContext.checkPermission(AccessControlConte
    xt.java:272)
    at java.security.AccessController.checkPermission(AccessController.java:
    399)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
    at java.lang.SecurityManager.checkConnect(SecurityManager.java:1042)
    at java.net.InetAddress.getAllByName0(InetAddress.java:559)
    at java.net.InetAddress.getAllByName0(InetAddress.java:540)
    at java.net.InetAddress.getByName(InetAddress.java:449)
    at java.net.Socket.<init>(Socket.java:100)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirect
    SocketFactory.java:25)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMaster
    SocketFactory.java:120)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:499)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:190
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:174)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:318)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at java.rmi.Naming.lookup(Naming.java:84)
    at examples.hello.HelloApplet.init(HelloApplet.java:23)
    at sun.applet.AppletPanel.run(AppletPanel.java:344)
    at java.lang.Thread.run(Thread.java:484)
    The helloapplet.java code is :
    package examples.hello;
    import java.applet.Applet;
    import java.awt.Graphics;
    import java.rmi.Naming;
    import java.rmi.RemoteException;
    public class HelloApplet extends Applet {
    String message = "blank";
    // "obj" is the identifier that we'll use to refer
    // to the remote object that implements the "Hello"
    // interface
    Hello obj = null;
    public void init() {
         try {
              System.out.println("Path looking: " +getCodeBase().getHost());
         //obj = (Hello)Naming.lookup("//" +
              //     getCodeBase().getHost() + "/HelloServer");
                   obj = (Hello)Naming.lookup("//Neind-ws-003/HelloServer");
         message = obj.sayHello();
         } catch (Exception e) {
         System.out.println("HelloApplet exception: " +
                        e.getMessage());
         e.printStackTrace();
    public void paint(Graphics g) {
         g.drawString(message, 25, 50);
    The helloclient.html code:
    <HTML>
    <title>Hello World</title>
    <center> <h1>Hello World</h1> </center>
    The message from the HelloServer is:
    <p>
    <applet
              code="examples.hello.HelloApplet"
    width=500 height=120>
    </applet>
    </HTML>

    Your problem is at the following line.
    obj = (Hello)Naming.lookup("//Neind-ws-003/HelloServer");
    The line you had commented beforehand is
    //obj = (Hello)Naming.lookup("//" +
    // getCodeBase().getHost() + "/HelloServer");
    This worked because the applet was being retreived from the same server where the RMI server exists.
    Remember, applets can only connect themselfs to the same host they are stored in and retreived from. This is because of VM, the sandbox does not allow you to connect to other machines other than the server where it resides on. If you use a applet viewer it might work if you loosen the security features. On a browser i do not belive it can be done. Maybe if you modify your security options for the VM you are able to achieve something, but personally i'm going for the "It cannot be done " answer because of what I said before.
    Hope this helps
    If any trouble then reply and I'll answer later.
    Rui P.

  • Query Execution in RSRT is giving error DBMAN099

    Dear All,
    i have a BEX query which is being used in the BO dashboards.
    Bex query is created on a mutiprovider having one cube C_0PUR_C and one standard DSO CO_0PURD.
    cube and DSO contains custom date fields like ck_grdt which are created as key figures with aggregation type as summation in old version 3.x data flow.
    after migration of data flows from 3.x to 7.4 on HANA aggregation type is summation is not supported.
    The info object is not allowing to change the  aggregation type. how can change the aggregation type of key figures from Summation to Maximum or Minimum.
    Is there possibility to replace the key figure with out deleting data from the data targets?
    Regards,
    Srimanth

    HI Sri,
    Yes replacement if the existing  key figures is possible.Please look for re-modelling concept you will find useful documents for the same.
    you can also create new Key figures with (different Exception aggregation)map the same to the existing key-figure and use the same in your queries too.
    Please do revert in case of any concerns.
    Thanks & Regards,
    RDS

  • Query running time

    Hai,
    I am new to Oracle. How to find the query running time in SQL plus.
    Edited by: user12283394 on Dec 20, 2009 10:33 PM

    SQL> set line 2000;
    SQL> set timing on;
    SQL> select instance_name
    2 from V$instance;
    INSTANCE_NAME
    syslog
    Elapsed: 00:00:00.03
    SQL>
    Regards
    Asif Kabir

  • I am geeting problem whem i run bulk insert query i got error Location:_ bcpimp.cpp:1797 Expression:_ cbOutTemp cbOutputStr SPID:__ 52 Process ID:_ 2364 Msg 3624, Level 20, State 1, Line 3 A system assertion check has failed. Check the SQL Server error

    Location: bcpimp.cpp:1797
    Expression: cbOutTemp < cbOutputStr
    SPID: 52
    Process ID: 2364
    Msg 3624, Level 20, State 1, Line 3
    A system assertion check has failed. Check the SQL Server error log for details. Typically, an assertion failure is caused by a software bug or data corruption. To check for database corruption, consider running DBCC CHECKDB. If you agreed to send dumps to
    Microsoft during setup, a mini dump will be sent to Microsoft. An update might be available from Microsoft in the latest Service Pack or in a QFE from Technical Support. 
    Msg 0, Level 20, State 0, Line 0
    A severe error occurred on the current command.  The results, if any, should be discarded.

    If you check your sql server error log folder you will see dump files created. You need to send those dump files to Microsoft for inspection because outside of microsoft product support the symbols for reading the dumps are not available without which it
    wont be easy to find the issue.
    http://support.microsoft.com/kb/2028589
    In the meantime check if you are on the latest version of Service Pack and if not apply the latest service pack. Majority of these kind of assertions are bugs which are solved in Service Packs/Cumulative Updates.
    Regards, Ashwin Menon My Blog - http:\\sqllearnings.com

  • Why this query is giving error in report

    I have a simple query ...
    SELECT &P_FLEXDATA C_FLEXDATA,
    CHART_OF_ACCOUNTS_ID C_NUM
    FROM GL_CODE_COMBINATIONS
    It is running fine in SQL prompt but when I create it as a report query then it is giving error: ORA-00904 "C_FLEXDATA": invalid identifier
    Please advise ....
    I shall be ever thankful...
    Best Regards

    Hello,
    You are using a "lexical" reference in the SQL query (&P_FLEXDATA).
    You must set a default value for P_FLEXDATA in order the SQL Query to be parsed successfuly
    Regards

  • PL/SQL function body returning SQL query - ORA-06502: PL/SQL: numeric or value error

    I'm attempting to dynamically generate a rather large SQL query via the "PL/SQL function body returning SQL query" report region option.  The SQL query generated will possibly be over 32K.  When I execute my page, I sometimes receive the "ORA-06502: PL/SQL: numeric or value error" which points to a larger than 32K query that was generated.  I've seen other posts in the forum related to this dynamic SQL size limitation issue, but they are older (pre-2010) and point to the 32K limit of the DNS (EXECUTE IMMEDIATE) and DBMS_SQL.  I found this post (dynamic sql enhancements in 11g) which discusses 11g no longer having the 32K size limitation for generating dynamic SQL.  Our environment is on 11gR2 and using ApEx 4.2.1.  I do not know which dynamic SQL method -- DNS or DBMS_SQL -- ApEx 4.2.1 is using.  Can someone clarify for me which dynamic SQL method ApEx uses to implement the "PL/SQL function body returning SQL query" option?
    As a test, I created a page on apex.oracle.com with a report region with the following source:
    declare
      l_stub varchar2(25) := 'select * from sys.dual ';
      l_sql  clob := l_stub || 'union all ';
      br     number(3) := 33;
    begin
      while length ( l_sql ) < 34000 loop
        l_sql := l_sql || l_stub || 'union all ';
      end loop;
      l_sql := l_sql || l_stub;
      for i in 1 .. ceil ( length ( l_sql ) / br ) loop
        dbms_output.put_line ( dbms_lob.substr ( l_sql, br, ( ( i - 1 ) * br ) + 1 ) );
      end loop;
      return l_sql;
    end;
    The dbms_output section is there to be able to run this code in SQL*Plus and confirm the size of the SQL is indeed larger than 32K.  When running this in SQL*Plus, the procedure is successful and produces a proper SQL statement which can be executed.  When I put this into the report region on apex.oracle.com, I get the ORA-06502 error.
    I can certainly implement a work-around for my issue by creating a 'Before Header' process on the page which populates an ApEx collection with the data I am returning and then the report can simply select from the collection, but according to documentation, the above 32K limitation should be resolved in 11g.  Thoughts?
    Shane.

    What setting do you use in your report properties - especially in Type and in Region Source?
    If you have Type="SQL Query", then you should have a SELECT statement in the Region Source. Something like: SELECT .... FROM ... WHERE
    According to the ERR-1101 error message, you have probably set Type to "SQL Query (PL/SQL function body returning SQL query)". In this situation APEX expects you to write a body of a PL/SQL function, that will generate the text of a SQL query that APEX should run. So it can be something like:
    declare
    mycond varchar2(4000);
    begin
    if :P1_REPORT_SEARCH is not null THEN
    mycond:='WHERE LAST_NAME like :P1_REPORT_SEARCH ||''%''';
    end if;
    return 'select EMPLOYEE_ID, FIRST_NAME, LAST_NAME from EMPLOYEES ' ||mycond;
    end;
    And for escaping - are you interested in escaping the LIKE wildcards, or the quotes?
    For escaping the wildcards in LIKE function so that when the user enters % you will find a record with % and not all functions, look into the SQL Reference:
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/conditions007.htm
    (You would than need to change the code of your function accordingly).
    If you are interested in escaping the quotes, try to avoid concatenating the values entered by the user into the SQL. If you can, use bind variables instead - as I have in my example above. If you start concatenating the values into the text of SQL, you are open to SQLInjection - user can enter anything, even things that will break your SQL. If you really need to allow users to choose the operator, I would probably give them a separate combo for operators and a textfield for values, than you could check if the operator is one of the allowed ones and create the condition accordingly - and than still use bind variable for inserting the filtering value into the query.

  • Top N query giving error for oracle 8.0.6

    Dear All,
    We are executing this query SELECT XBLNR, WERKS, MATNR, MDV01, BACKFLQUANT, STATUS, SAPTIMESTAMP, PITSTIMESTAMP, PMTIMESTAMP, BATCH FROM (SELECT XBLNR, WERKS, MATNR, MDV01, BACKFLQUANT, STATUS, SAPTIMESTAMP, PITSTIMESTAMP, PMTIMESTAMP, BATCH FROM PMBPITS.PITS_UNITY WHERE STATUS = '01' ORDER BY PMTIMESTAMP) WHERE ROWNUM < 20
    on oracle 8.0.6 but this is giving the following error
    ora - 00907 missing right parenthesis error
    1. Is it that in the inner select we cannot use order by and where clause together.
    2. We also found that if we remove order by from inner select then the query is not giving error
    pls help . points will be awarded

    Hi,
    what ever the Aman said is correct. You check this is supported in 8.1.5, SQL allows you to embed the ORDER BY clause in a subquery and place the ROWNUM condition in the top-level query;
    'Top-N query' is a ORACLE 8i feature which is supported in SQL. However,
    Bug:855720 states the following:
    "PL/SQL does not support top-N queries (ORDER BY in SUBSELECT/SUBQUERY
    or VIEW. Since this feature is available in SQL, but not in PL/SQL,
    it has been logged as a Bug that will be fixed in 8.1.6."
    - Pavan Kumar N

  • Giving error in update query

    This is my update query in oracle but it is giving error:
    Update (select NM.Nominal_Amount,NM.Number_of_Units,NM.Current_Spot,NM.Published_Spot,NM.Strike_Price
    from note_master NM ,
    (     select NORM.Note_Master_ID, NORM.Asset, NORM.Currency , 50 as Spot_Price_Calc,      NVL(TOADD.NA,0) As NA, NVL(TOADD.NS,0)
    As NS, NVL(TOADD.NA_P,0) As NA_P, NVL(TOADD.NS_P,0) As NS_P, NVL(TOADD.SA,0) As SA,      (50 * (NORM.Strike_Price_Per/100)) as
    rike_Price_Calc,      (Case When UPPER(NORM.Misc2) = 'Q' THEN (NORM.No_Of_Shares * 50 * (NORM.Strike_Price_Per/100)) Else
    NORM.Nominal_Amount End )as Nominal_Amount_Calc,     (Case When UPPER(NORM.Misc2) ='N' THEN (NORM.Nominal_Amount /( 50 * (NORM.Strike_Price_Per/100)))
    Else NORM.No_Of_Shares End )as NO_Of_Shares_Calc,     (Case When UPPER(NORM.Misc2) = 'Q' THEN (NORM.No_Of_Shares * 50 * (NORM.Strike_Price_Per/100) * NORM.Issue_Price )/100
    Else (NORM.Nominal_Amount * NORM.Issue_Price )/100 End )as Settlement_Amt_Calc     from      (          select Note_Master_Id, MIN(Spot_Price) as Spot_Price, Min(Strike_Price) as
    Strike_Price, SUM(Nominal_Amount) as Nominal_Amount, SUM(No_Of_Shares) as No_Of_Shares , MIN(Issue_Price) as Issue_Price, MIN(Asset) as Asset, MIN(Currency) as Currency,
    MIN(Strike_Price_Per) as Strike_Price_Per, MIN(Misc2) as Misc2      from      (          Select Note_Master_Id, Spot_Price, Strike_Price, Nominal_Amount, No_Of_Shares, Issue_Price, Asset,
    Currency , Strike_Price_Per,Misc2      from Sample_ADF_FinIQ_Common.Note_Order_RM      Where Order_Status_Flag = 'YYYYYYNNNNNNNNNN'      And RO_ID = 'R000000002'     ) NORM      Group by Note_Master_Id     ) NORM
    Left Outer JOIN Sample_ADF_FinIQ_Common.RATESSPOTBIDASK RSBA     On RSBA.PairCode = (NORM.Asset )          Left Outer JOIN      (     select Note_Master_ID,sum(Nominal_Amount)
    as NA, sum(No_Of_Shares) as NS, sum(NominalAmt_Pending) as NA_P, sum(NoOfShares_Pending) as NS_P,sum(Settlement_Amt) as SA      from Note_Order_RM     
    Where RO_ID <> 'R000000002'     group by Note_Master_ID ) TOADD     On TOADD.Note_Master_ID = NORM.Note_Master_ID ) RESULT1 where NM.Note_Master_ID = RESULT1.Note_Master_ID )
    set      Price_Updated_YN = 'Y'           ,
    Nominal_Amount = RESULT1.NA + RESULT1.Nominal_Amount_Calc          , Number_Of_Units = RESULT1.NS + RESULT1.NO_Of_Shares_Calc          ,
    Current_Spot = RESULT1.Spot_Price_Calc           , Published_Spot = RESULT1.Spot_Price_Calc           , Strike_Price = RESULT1.Strike_Price_Calc
    where NM.Note_Master_ID = RESULT1.Note_Master_ID;
    error :
    rror at Command Line:17 Column:105
    Error report:
    SQL Error: ORA-00904: "RESULT1"."STRIKE_PRICE_CALC": invalid identifier
    00904. 00000 - "%s: invalid identifier"
    can anybody help.
    Thanks

    Still one more typo problem exists in you sql stament , equal to(=) operator is missing in your original statement look below
    original
    Where RO_ID 'R000000002'     group by Note_Master_ID ) TOADD     On TOADD.Note_Master_ID = NORM.Note_Master_ID ) RESULT1 where NM.Note_Master_ID = RESULT1.Note_Master_ID )
    set Price_Updated_YN = 'Y'
    modified
    Where RO_ID='R000000002'     group by Note_Master_ID ) TOADD     On TOADD.Note_Master_ID = NORM.Note_Master_ID ) RESULT1 where NM.Note_Master_ID = RESULT1.Note_Master_ID )
    set Price_Updated_YN = 'Y' Ok, once try with this code, some syntax prob i modified it.
    Update (select NM.Nominal_Amount,NM.Number_of_Units,NM.Current_Spot,NM.Published_Spot,NM.Strike_Price
    from note_master NM ,
    (     select NORM.Note_Master_ID, NORM.Asset, NORM.Currency , 50 as Spot_Price_Calc, NVL(TOADD.NA,0) As NA, NVL(TOADD.NS,0)
    As NS, NVL(TOADD.NA_P,0) As NA_P, NVL(TOADD.NS_P,0) As NS_P, NVL(TOADD.SA,0) As SA, (50 * (NORM.Strike_Price_Per/100)) as
    Strike_Price_Calc, (Case When UPPER(NORM.Misc2) = 'Q' THEN (NORM.No_Of_Shares * 50 * (NORM.Strike_Price_Per/100)) Else
    NORM.Nominal_Amount End )as Nominal_Amount_Calc,     (Case When UPPER(NORM.Misc2) ='N' THEN (NORM.Nominal_Amount /( 50 * (NORM.Strike_Price_Per/100)))
    Else NORM.No_Of_Shares End )as NO_Of_Shares_Calc,     (Case When UPPER(NORM.Misc2) = 'Q' THEN (NORM.No_Of_Shares * 50 * (NORM.Strike_Price_Per/100) * NORM.Issue_Price )/100
    Else (NORM.Nominal_Amount * NORM.Issue_Price )/100 End )as Settlement_Amt_Calc     from (      select Note_Master_Id, MIN(Spot_Price) as Spot_Price, Min(Strike_Price) as
    Strike_Price, SUM(Nominal_Amount) as Nominal_Amount, SUM(No_Of_Shares) as No_Of_Shares , MIN(Issue_Price) as Issue_Price, MIN(Asset) as Asset, MIN(Currency) as Currency,
    MIN(Strike_Price_Per) as Strike_Price_Per, MIN(Misc2) as Misc2 from (      Select Note_Master_Id, Spot_Price, Strike_Price, Nominal_Amount, No_Of_Shares, Issue_Price, Asset,
    Currency , Strike_Price_Per,Misc2 from Sample_ADF_FinIQ_Common.Note_Order_RM Where Order_Status_Flag = 'YYYYYYNNNNNNNNNN' And RO_ID = 'R000000002'     ) NORM Group by Note_Master_Id     ) NORM
    Left Outer JOIN Sample_ADF_FinIQ_Common.RATESSPOTBIDASK RSBA     On RSBA.PairCode = (NORM.Asset )      Left Outer JOIN (     select Note_Master_ID,sum(Nominal_Amount)
    as NA, sum(No_Of_Shares) as NS, sum(NominalAmt_Pending) as NA_P, sum(NoOfShares_Pending) as NS_P,sum(Settlement_Amt) as SA from Note_Order_RM     
    Where RO_ID 'R000000002'     group by Note_Master_ID ) TOADD     On TOADD.Note_Master_ID = NORM.Note_Master_ID ) RESULT1 where NM.Note_Master_ID = RESULT1.Note_Master_ID )
    set Price_Updated_YN = 'Y' ,
    Nominal_Amount = RESULT1.NA + RESULT1.Nominal_Amount_Calc      , Number_Of_Units = RESULT1.NS + RESULT1.NO_Of_Shares_Calc      ,
    Current_Spot = RESULT1.Spot_Price_Calc , Published_Spot = RESULT1.Spot_Price_Calc , Strike_Price = RESULT1.Strike_Price_Calc
    where NM.Note_Master_ID = RESULT1.Note_Master_ID;Edited by: darkStargate on Dec 8, 2011 7:42 PM

  • Help: SQL query when parsed returns Invalid Identifier error

    Hi The expression posted below is the actual SQL Expression which is required in my report:
    ((select name from (
    select loc_id,name,row_number()over(  order by r)  rn from (
    SELECT 0, loc_id, Misc1_txt  NAME,'A' STATUS ,rownum r
                        FROM dvxloc
                       WHERE loc_id = "XXXLOC"."LOC_ID"
                       union
    SELECT     parent_loc_id, loc_id, (SELECT a.Misc1_txt
                                                         FROM dvxloc a
                                                        WHERE a.loc_id =b.loc_id) NAME,'B' ,ROWNUM
                            FROM dvxlocpath b
                      START WITH b.loc_id = "XXXLOC"."LOC_ID"
                      CONNECT BY PRIOR  parent_loc_id=loc_id
    )                where name is NOT NULL        order by STATUS, R
    ) where rn = 1))
    It gives an error while parsing: "XXXLOC"."LOC_ID" invalid identifier
    LOC_ID is of numeric data type in the database. and when I run thi query in SQL editor after replacing "XXXLOC"."LOC_ID" with a numeric value say 456 . The query can be put as
    ((select name from (
    select loc_id,name,row_number()over(  order by r)  rn from (
    SELECT 0, loc_id, Misc1_txt  NAME,'A' STATUS ,rownum r
                        FROM dvxloc
                       WHERE loc_id = 456                   union
    SELECT     parent_loc_id, loc_id, (SELECT a.Misc1_txt
                                                         FROM dvxloc a
                                                        WHERE a.loc_id =b.loc_id) NAME,'B' ,ROWNUM
                            FROM dvxlocpath b
                      START WITH b.loc_id = 456                  CONNECT BY PRIOR  parent_loc_id=loc_id
    )                where name is NOT NULL        order by STATUS, R
    ) where rn = 1))
    The above query runs flawlessly in a SQL editor. and also this is parsed by the crystal sql expression editer
    I'm totally messed up of looking for altenatives. I have to deliver a report to the client and stuck on this part only.
    The below query parses perfectly in crystal:
    (select locname
    from dvxloc where loc_id in(select loc3 from dvxlocpath
    where loc_id = "XXXLOC"."LOC_ID"))
    Edited by: vipulbhatia29 on May 8, 2009 11:06 AM
    Edited by: vipulbhatia29 on May 8, 2009 11:14 AM

    You said the above works in SQL Editor but does your original work?
    ((select name from (
    select loc_id,name,row_number()over( order by r) rn from (
    SELECT 0, loc_id, Misc1_txt NAME,'A' STATUS ,rownum r
    FROM dvxloc
    WHERE loc_id = "XXXLOC"."LOC_ID"
    union
    SELECT parent_loc_id, loc_id, (SELECT a.Misc1_txt
    FROM dvxloc a
    WHERE a.loc_id =b.loc_id) NAME,'B' ,ROWNUM
    FROM dvxlocpath b
    START WITH b.loc_id = "XXXLOC"."LOC_ID"
    CONNECT BY PRIOR parent_loc_id=loc_id
    ) where name is NOT NULL order by STATUS, R
    ) where rn = 1))
    Crystal does nothing to the SQL in the command editor, what you type in is what we pass.
    What database are you connecting to? And if it has a tracing tool what SQL are you seeing from Crystal when you try to run the report?

Maybe you are looking for

  • Windows 7 IPv4 resolution of own host name problem

    Hi, Preconditions: I have a Windows 7 SP1 with 2 network adapters. LAN1 has a static IP address and shall be used by our applications. LAN2 uses DHCP. DNS or WINS is servers are not available. For the applications it is necessary that the own FQDN re

  • [SOLVED] Broken Gwibber/couchdb after Apr 9 upgrade

    After a 1.3GB upgrade (2.6.33, ssl, gtk, ssh...) I can no longer use Gwibber. I use the following components: aur/couchdb 0.11.0-1 aur/python-couchdb 0.6.1-1 aur/desktopcouch 0.6.3-3 aur/gwibber-new 2.29.94-1 When I start gwibber I get: Traceback (mo

  • Problem with hostname after enabling dhcp

    i just installed a solaris10 non-networked because there was no network connection when i installed it. but recently, we were able to connect it to a network which required me to enable dhcp which i did with a sys-unconfig command. the problem is, th

  • ARD Admin tied to a single machine?

    Recent discussions of piracy aside, this is meant as a technical question rather than a legal question. If ARD Admin unlimited is installed on an external 10.4 startup drive, can ARD on the external drive be used reliably with different computers? Or

  • What are these posts from group ASSA doing here?

    assa - Novell - NetIQ - SUSE I see results on searches of this group also.