Query Throws Random Errors?

Hello, can anyone tell me why SAP throws random errors when trying to execute below query in Query Manager?
SAP opens and asks the user for the correct parameters but errors on execution.
/*SELECT FROM [dbo].[OHEM] T0*/
DECLARE @FirstName AS NVARCHAR(50)
/* WHERE */
SET @FirstName = /* T0.firstName */ '[%0]'
/*SELECT FROM [dbo].[OHEM] T1*/
DECLARE @LastName AS NVARCHAR(50)
/* WHERE */
SET @LastName = /* T1.lastName */ '[%1]'
/*SELECT FROM [dbo].[OFPR] T2*/
DECLARE @StartDate AS date
/* WHERE */
SET @StartDate = /* T2.F_RefDate */ '[%2]'
/*SELECT FROM [dbo].[OFPR] T3*/
DECLARE @EndDate AS date
/* WHERE */
SET @EndDate = /* T3.T_RefDate */ '[%3]'
Select     (EMP.firstName + ' ' + EMP.lastName) As Name,
               BL.TRANSDATE As Date,
               SJ.JOBID As [WO#],
               BL.SUBJOBID As [Tool ID],
               BL.STOCKCODE As Pay,
               CASE When TIMETYPE = 0
                    Then ISNULL(QTY,0)
                    Else 0
               End As ST,
               CASE When TIMETYPE = 1
                    Then ISNULL(QTY,0)
                    Else 0
               End As OT,
               CASE When TIMETYPE = 2
                    Then ISNULL(QTY,0)
                    Else 0
               End As DT
From OHEM EMP
     Inner Join ENPRISE_JOBCOST_TEMPBATCHJOBLINES BL On EMP.empID = BL.EMPID
     Inner Join ENPRISE_JOBCOST_SUBJOB SJ On SJ.SUBJOBID = BL.SUBJOBID
Where firstName Like @FirstName + '%' And lastName Like @LastName + '%'
And BL.TRANSDATE Between Convert(Datetime,@StartDate) And Convert(Datetime,@EndDate)
Group By     EMP.firstName,
                    EMP.lastName,
                    BL.TRANSDATE,
                    SJ.JOBID,
                    BL.SUBJOBID,
                    BL.STOCKCODE,
                    TIMETYPE,
                    QTY,
                    BL.EMPID
Order By Name
Thanks,
Mike

Hi Mike,
Can you try :
From OHEM EMP
     Inner Join dbo.[ENPRISE_JOBCOST_TEMPBATCHJOBLINES] BL On EMP.empID = BL.EMPID
     Inner Join dbo.[ENPRISE_JOBCOST_SUBJOB] SJ On SJ.SUBJOBID = BL.SUBJOBID
Regards
Edy

Similar Messages

  • Query throws an error while drilldowning a particular column in production

    Hello Gurus,
    There is an issue in a query when I run it on portal and when I try to drill down one particular column, it throws an error. I am pasting the error message below for your reference. This query works fine when I run in Bex. It also works fine when I run it on Quality portal. It only throws an error when I run it on production portal. I have got the patches and PI checked with BASIS team, everything seems to be fine.
    Please help me out with this issue.
    Termination message sent
    ABEND RSBOLAP (000): Program error in class SAPMSSY1 method : UNCAUGHT_EXCEPTION
      MSGV1: SAPMSSY1
      MSGV3: UNCAUGHT_EXCEPTION
    com.sap.ip.bi.base.application.exceptions
    ABEND: Program error in class SAPMSSY1 method : UNCAUGHT_EXCEPTION
    ABEND: System error in program SAPLRRK0 and form LRECH_01-01- (see long text)
    Regards,

    Hi,
    There are a couple of threads on the same issue.
    Refer to these, just might be handy.
    Re: Uncaught_exception in Report Designer
    Program error in class SAPMSSY1 method  : UNCAUGHT_EXCEPTION in Report
    Good Luck!
    Sandeep Tudumu

  • SQL server agent jobs throws random errors while the ETL process works fine.

    Hi,
    I have this problem with SQL agent jobs.
    We went from sql2008 to sql2012 and migrated SSIS without problems. The ETL process runs fine and the OLAP cubes are processed.
    I have a job which calls the master execution dtsx for a particulair customer. When the ETL load and OLAP is processed it should go to the next customer. The problem i have is that the agent logs some errors for random customers. I tried to do only two clients
    in one job this works then i add the third client and then it fails (log wise) for a customer which did run successfully before when there were only two customers.
    Despite the error message the ETL did run, there were no duplicate keys and OLAP was processed???
    Im very close to pull all my hair, because some combinations like two customers work, and placing these two customers with a third one it then fails again. (again cubes are processed and data is integer yet i keep getting these annoying errors in the log)
    Perhaps someone could help me further. 
    -Miracles are easy, the impossible takes a bit longer-

    Just double-click on the Agent job, then click on Steps property page (on your left), you must be able to see a list of steps with the action "On Failure" which you should examine.
    Arthur My Blog

  • Planning query throwing error

    Hi
    I have created an aggregation level on a multiprovider that contains data from plan and actuals cube.
    When I created a query on aggregation level it works for the given selection, but when i change one of the key figures properties to 'plannning' mode, the query throws an error saying "Syntax error in program CL_RSR_RRK0_KEYFIGURE=========CP " showing some exception has occurred.
    We are on version 7, SP 13.
    Appreciate any help regarding the same.

    OK. One last thing to check; you said you restricted the data in the query by 0infoprov right? You did that with a rest key fig or made local selections?
    I sugest to have a rest key fig with your key fig and 0infopro and set this rest key fig as planning enabled.
    Ravi Thothadri

  • Finding: Incorrect SQL throws a random error (after 2005 upgrade)

    Hi I thought that I would share an experience that we found after upgrading a system to 2005:
    Due to the upgrade of SBO, one of our addons didn't work properly after upgrading it to 2005.  Basically the code would break in random places (while stepping through it in the Development Environment).
    After some time we identified the error was being thrown because a sql query we were using was incorrect due to the changing of the DB structure in the upgrade.  The weird thing was that it didn't throw an error at rs.DoQuery(query) but actually would step into the recordset and then the addon would suddenly stop working - hence the reason it took a while to identify it was the sql causing the problem.
    Anyway updating the sql fixed the problem, but if anyone else is finding strange behavior whilst trying to identify why an addon might stop working after an upgrade, you should check any sql being used is still correct....
    Daniel

    The first versions of SBO2005A SDK (PL00 to PL04) was the say the least VERY buggy... PL05,06 and now 07 seem to get things under control... Any rampup version of 2005 should at least get up PL05 ASAP... I didnt have many problem with the SQL, but "Server produced an error was a very common error".. my problem was primarily in matrixes (add/remove of lines), itemevent (pval internal COM error) and the dangerouse UserTable error due to currupted object in it....

  • Query is throwing an error like missing right paranthesis.,

    Hi,
    The below query is throwing an error like missing right paranthesis.,
    and Is there any way to write the same query in a simpler way ?
    SELECT AVALABLEBALANCE
    FROM (
    ( SELECT SUM(TH1.TRANSACTIONAMOUNT)
    FROM TRANSACTIONHISTORY TH1,
    TRANSACTIONTYPE TT,
    CARDDETAIL CD,
    P2P_CARDDETAIL P2P
    WHERE TH1.TRANSACTIONTYPEID = TT.TRANSACTIONTYPEID
    AND TH1.CARDID = CD.CARDID
    AND CD.CARDID = P2P.CARDID
    AND TH1.CARDID = 6013
    AND TT.TRANSACTIONTYPECODE IN ('WITHDRAWAL_CHECK_FEE')
    AND TRUNC(TH1.TRANSACTIONDATETIME) = TRUNC(TH3.TRANSACTIONDATETIME)
    GROUP BY TH1.TRANSACTIONTYPEID,TH1.CARDID,TRUNC(TH1.TRANSACTIONAMOUNT)) -
    ( SELECT SUM(TH2.TRANSACTIONAMOUNT)
    FROM TRANSACTIONHISTORY TH2,
    TRANSACTIONTYPE TT,
    CARDDETAIL CD,
    P2P_CARDDETAIL P2P
    WHERE TH2.TRANSACTIONTYPEID = TT.TRANSACTIONTYPEID
    AND TH2.CARDID = CD.CARDID
    AND CD.CARDID = P2P.CARDID
    AND TH2.CARDID = 6013
    AND TT.TRANSACTIONTYPECODE IN ('FUND_TRANSFER_RECEIVED')
    AND TRUNC(TH2.TRANSACTIONDATETIME) = TRUNC(TH3.TRANSACTIONDATETIME)
    GROUP BY TH2.TRANSACTIONTYPEID,TH2.CARDID,TRUNC(TH2.TRANSACTIONAMOUNT))
    ) T , TRANSACTIONHISTORY TH3
    WHERE TH3.CARDID = 6013

    Hi Sekar,
    Here is your formatted code:
    /* Formatted on 2007/11/16 16:42 (Formatter Plus v4.8.0) */
    SELECT avalablebalance
    FROM ((SELECT SUM (th1.transactionamount)
    FROM transactionhistory th1,
    transactiontype tt,
    carddetail cd,
    p2p_carddetail p2p
    WHERE th1.transactiontypeid = tt.transactiontypeid
    AND th1.cardid = cd.cardid
    AND cd.cardid = p2p.cardid
    AND th1.cardid = 6013
    AND tt.transactiontypecode IN ('WITHDRAWAL_CHECK_FEE')
    AND TRUNC (th1.transactiondatetime) =
    TRUNC (th3.transactiondatetime)
    GROUP BY th1.transactiontypeid,
    th1.cardid,
    TRUNC (th1.transactionamount))
    MINUS
    (SELECT SUM (th2.transactionamount)
    FROM transactionhistory th2,
    transactiontype tt,
    carddetail cd,
    p2p_carddetail p2p
    WHERE th2.transactiontypeid = tt.transactiontypeid
    AND th2.cardid = cd.cardid
    AND cd.cardid = p2p.cardid
    AND th2.cardid = 6013
    AND tt.transactiontypecode IN ('FUND_TRANSFER_RECEIVED')
    AND TRUNC (th2.transactiondatetime) =
    TRUNC (th3.transactiondatetime)
    GROUP BY th2.transactiontypeid,
    th2.cardid,
    TRUNC (th2.transactionamount))) t,
    transactionhistory th3
    WHERE th3.cardid = 6013
    -Edit: Lol this forum's text box does not have a proper formatter to show our codes perfectly :(.. Very sorry about the expected format here.. Lol !!
    ***Lol Poor Format***
    Message was edited by:
    user599090
    I replaced the '-' with MINUS Keyword. That was the mistake you made i guess.

  • SQL query throws not understandable error

    Hi everybody,
    I am suffering from an issue where I query Oracle database 11g with this query:
    SELECT AUDIT_EVENT.EVENT_ID, USER_NAME, START_TIMESTAMP, AUDIT_EVENT.DURATION, AUDIT_EVENT.EVENT_TYPE_ID, AUDIT_EVENT.SERVER_CUID, OBJECT_CUID, OBJECT_TYPE, ERROR_CODE, OBJECT_ID, DETAIL_ID, AUDIT_DETAIL.SERVER_CUID, AUDIT_DETAIL.DETAIL_TYPE_ID, DETAIL_TYPE_DESCRIPTION, EVENT_TYPE.EVENT_TYPE_DESCRIPTION, SUBSTR(DETAIL_TEXT,0,200) as DETAIL_TEXT FROM (audit_detail join detail_type on audit_detail.detail_type_id=detail_type.detail_type_id) join (audit_event join event_type on audit_event.event_type_id=event_type.event_type_id) on audit_event.event_id=audit_detail.event_id WHERE to_char(START_TIMESTAMP,'YYYYMMDD') > '20110307' AND to_char(START_TIMESTAMP,'YYYYMMDD')<='20110309' ORDER BY START_TIMESTAMP
    which throws this error:
    ORA-01652: unable to extend temp segment by 128 in tablespace TEMP
    01652. 00000 - "unable to extend temp segment by %s in tablespace %s"
    *Cause:    Failed to allocate an extent of the required number of blocks for
    a temporary segment in the tablespace indicated.
    *Action:   Use ALTER TABLESPACE ADD DATAFILE statement to add one or more
    files to the tablespace indicated.
    Can anybody explain why this can happen? Are we somehow limited with temporary space or whatever? Because when I put the same query withou condition placed after WHERE clause it seems to work correctly...
    Appreciate any help..
    Thank You
    Miro

    Temp space can be used for SORTS and HASH joins, for example.
    See documentation for further details:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17120/tspaces002.htm#i1013552
    http://download.oracle.com/docs/cd/E11882_01/server.112/e16638/memory.htm#PFGRF01401
    Please review the execution plans for both queries that you mention.
    e.g.
    explain plan for...
    select * from table(dbms_xplan.display);The output of dbms_xplan should display expected/estimated temp space usage.
    Please see the following thread for more detail:
    How to post a SQL tuning request - HOW TO: Post a SQL statement tuning request - template posting
    I see that you using a TO_CHAR on your START_TIMESTAMP column.
    This is a classic way of preventing index usage which may lead to inefficient plans which might cause unexpected temp space usage.
    See execution plans for further detail.
    If START_TIMESTAMP is indexed, then doing the following may result in a more efficient plan which might lead to reduced temp space usage, any sort operation ing might even be eliminated:
    WHERE START_TIMESTAMP >= TO_DATE('20110307','YYYYMMDD')
    AND    START_TIMESTAMP < TO_DATE('20110309' ,'YYYYMMDD') + 1

  • C++ application with pro*c generating random errors

    Hi there,
    As described, I have a C++ application with a pro*c module to access the DB. The problem is that it produces random errors.
    Randomly, it fails executing a query, but other times it fails in other modules, or just opening a cursor. I list you two examples of queries that fail:
    ================================================================
    CHECK_CONNECTED
    EXEC SQL BEGIN DECLARE SECTION;
    long Id_db;
    long startValidityMicroseconds_db;
    long stopValidityMicroseconds_db;
    VARCHAR name_db [LEN_NAME + 1];
    VARCHAR creationDate_db [LEN_DATE + 1];
    VARCHAR startValidityDate_db [LEN_DATE + 7 + 1];
    VARCHAR stopValidityDate_db [LEN_DATE + 7 + 1];
    short name_db_ind;
    EXEC SQL END DECLARE SECTION;
    // Set the key
    Id_db = Id
    EXEC SQL SELECT NAME,
                             TO_CHAR(CREATION_DATE, :DATE_FORMAT),
                             TO_CHAR(START_VALIDITY_DATE, :DATE_FORMAT),
                             TO_CHAR(STOP_VALIDITY_DATE, :DATE_FORMAT),
                             NVL (START_VALIDITY_MICROSECONDS ,0),
                             NVL (STOP_VALIDITY_MICROSECONDS ,0),
    INTO :name_db :name_db_ind,
         :creationDate_db,
         :startValidityDate_db,
         :stopValidityDate_db,
         :startValidityMicroseconds_db,
         :stopValidityMicroseconds_db,
    FROM ROP_TB
    WHERE ID = :Id_db;
    ================================================================
    ================================================================
    CHECK_CONNECTED
    EXEC SQL BEGIN DECLARE SECTION;
         long objectId_db;
         VARCHAR objectName_db [LEN_OBJECT_NAME + 1];
    EXEC SQL END DECLARE SECTION;
    strncpy ((char *) objectName_db.arr, object_db.c_str (), LEN_OBJECT_NAME);
    objectName_db.len = object_db.length ();
    EXEC SQL DECLARE CU_OBJECT_TB CURSOR FOR
    SELECT OBJECT_ID INTO :objectId_db
    FROM OBJECT_TB
    WHERE OBJECT_NAME = :objectName_db;
    EXEC SQL OPEN CU_OBJECT_TB;
    ================================================================
    It keeps failing randomly and I don't know really know what my eyes are missing. Sometimes I get a "simple" seg fault because a query returned invalid values and my application crashes, other times I get oracle errors.
    I really hope someone could help me here :)
    Kind regards!

    Well, random because it is not always the same nor the error code.
    - Sometimes I get segmentation fault on "sqlcxt";
    - "ORA-01024: invalid datatype in OCI call" on queries that usually work
    - "ORA-03114: not connected to ORACLE" on queries that usually work
    I have run valgrind and the only "place" where there could be an issue is reported to be caused by oracle libs:
    ==27055== 8,214 bytes in 1 blocks are possibly lost in loss record 193 of 206
    ==27055== at 0x40046FF: calloc (vg_replace_malloc.c:279)
    ==27055== by 0x43E2975: nsbal (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x42F04E6: nsiorini (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x4300FD2: nsopenalloc_nsntx (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x42FFD73: nsopenmplx (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x42F91FD: nsopen (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x42BDAFE: nscall1 (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x42BB0D7: nscall (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x435F653: niotns (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x43F9E40: nigcall (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x436AD4B: osncon (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x41EAA31: kpuadef (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)

  • Next / Previous button throwing an error. Please help

    I wrote this next previous button code and it is throwing an
    error. I don't understand why or what I am missing.
    I want it to show 4 records for a page. Here is my code and
    the error.
    Code:
    <cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
    <cfquery name="feat" datasource="#sitedatasource#"
    username="#siteUserID#" password="#sitePassword#" maxRows=4>
    SELECT feature.title AS ViewField1, feature.MYFile AS
    ViewField2, feature.ID AS ID
    FROM feature
    </cfquery>
    <cflock timeout="2" scope="application"
    type="READONLY">
    <cfset application.feat=feat>
    </cflock>
    <cfset MaxRows_feat=4>
    <cfset
    StartRow_feat=Min((PageNum_feat-1)*MaxRows_feat+1,Max(feat.RecordCount,1))>
    <cfset
    EndRow_feat=Min(StartRow_feat+MaxRows_feat-1,feat.RecordCount)>
    <cfset
    TotalPages_feat=Ceiling(feat.RecordCount/MaxRows_feat)>
    <cfset QueryString_feat=Iif(CGI.QUERY_STRING NEQ
    "",DE("&"&CGI.QUERY_STRING),DE(""))>
    <cfset
    tempPos=ListContainsNoCase(QueryString_feat,"PageNum_feat=","&")>
    <cfif tempPos NEQ 0>
    <cfset
    QueryString_feat=ListDeleteAt(QueryString_feat,tempPos,"&")>
    </cfif>
    <cflock timeout="2" scope="application"
    type="READONLY"><cfoutput query="feat"
    maxrows="4">#ViewField1#</cfoutput></cflock>
    <cfif PageNum_feat GT 1>
    <a
    href="#CurrentPage#?PageNum_feat=#Max(DecrementValue(PageNum_feat),1)##QueryString_feat#"
    onmouseout="MM_swapImgRestore()"
    onmouseover="MM_swapImage('Previous','','../img/previous-over.gif',1)"><img
    src="../img/previous.gif" alt="Previous Records" name="Previous"
    width="96" height="27" border="0" id="Previous" /></a>
    <cfif PageNum_feat LT TotalPages_feat>
    <a
    href="#CurrentPage#?PageNum_feat=#Min(IncrementValue(PageNum_feat),TotalPages_feat)##Quer yString_feat#"
    onmouseout="MM_swapImgRestore()"
    onmouseover="MM_swapImage('next','','../img/next-over.gif',1)"><img
    src="../img/next.gif" alt="Next Record" name="next" width="96"
    height="27" border="0" id="next" /></a>
    The Error:
    Variable PAGENUM_FEAT is undefined.
    The error occurred in
    C:\Websites\x9vdzd\feature\featured.cfm: line 8
    6 : </cfquery>
    7 : <cfset MaxRows_feat=4>
    8 : <cfset
    StartRow_feat=Min((PageNum_feat-1)*MaxRows_feat+1,Max(feat.RecordCount,1))>
    9 : <cfset
    EndRow_feat=Min(StartRow_feat+MaxRows_feat-1,feat.RecordCount)>
    10 : <cfset
    TotalPages_feat=Ceiling(feat.RecordCount/MaxRows_feat)>
    I thought I had it defined! What am I missing?
    Thanks
    Phoenix

    that is strange... it should work fine - it does in my tests.
    here is somewhat updated & modified code to try. i have
    included
    comments to try and explain what is being done.
    basic logic is as follows:
    -form is submitted
    -check if file has been selected
    -try uploading new file
    -if new file upload succeeds, delete old file if it exists
    (as part of
    updating existing record, as new records obviously would not
    have any
    old image)
    -update/insert record data as necessary
    here's the code:
    <cfif isdefined("form.feat_OK")><!--- form submitted
    --->
    <!--- set file uploading vars --->
    <cfparam name="fileuploaded" type="boolean"
    default="false">
    <cfparam name="uploadedfile" default="">
    <cfset pathToFile = "c:\websites\x9vdzd\img\feature\">
    <!--- --->
    <cfif len(trim(form.MYFile))><!--- if a file has
    been selected --->
    <!--- try uploading new file --->
    <cftry>
    <cffile Action="upload" filefield="MYFile"
    accept="image/gif,
    image/jpg, image/jpeg, image/pjpeg"
    destination="#pathToFile" nameconflict="MAKEUNIQUE">
    <cfset fileuploaded = true>
    <cfset uploadedfile = cffile.serverfile>
    <cfcatch type="any">
    <!--- if upload did not suceed, reset file uploading vars
    --->
    <cfset fileuploaded = false>
    <cfset uploadedfile = "">
    <!--- this can be further enhanced by setting some var to
    hold error
    message and return it to user --->
    </cfcatch>
    </cftry>
    </cfif>
    <cfif form.id gt 0><!--- we are updating an
    existing record --->
    <!--- if new file upload was successful and the feature
    has an image
    associated with it - delete old image --->
    <cfif fileuploaded is true AND
    len(trim(form.oldimage))>
    <cfif FileExists(pathToFile & form.oldimage)>
    <cffile action="delete" file="#pathToFile &
    form.oldimage#">
    </cfif>
    </cfif>
    <cfquery datasource="#sitedatasource#"
    username="#siteUserID#"
    password="#sitePassword#">
    UPDATE feature
    SET
    feature.title=<cfqueryparam cfsqltype="cf_sql_varchar"
    value="#form.title#">,
    feature.Body=<cfqueryparam cfsqltype="cf_sql_longvarchar"
    value="#form.PDSeditor#">,
    feature.MYFile=<cfqueryparam cfsqltype="cf_sql_varchar"
    value="#uploadedfile#" null="#NOT fileuploaded#">
    WHERE ID = <cfqueryparam value="#form.ID#"
    cfsqlType="CF_SQL_INTEGER">
    </cfquery>
    <cfelse><!--- we are inserting a new record --->
    <cfquery datasource="#sitedatasource#"
    username="#siteUserID#"
    password="#sitePassword#">
    INSERT INTO feature
    (title, body, MYFile)
    VALUES
    (<cfqueryparam cfsqltype="cf_sql_varchar"
    value="#form.title#">,
    <cfqueryparam cfsqltype="cf_sql_longvarchar"
    value="#form.PDSeditor#">,
    <cfqueryparam cfsqltype="cf_sql_varchar"
    value="#uploadedfile#"
    null="#NOT fileuploaded#">)
    </cfquery>
    </cfif>
    <!--- relocate user to previous page after insert/update
    --->
    <cflocation url="feature-manager.cfm">
    </cfif>
    hth
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com

  • Optional Parameter - Oracle Package Throws an Error

    Hi there,
    I have an Oracle Package & it has a stored procedure with optional parameter. The calling code is in ColdFusion.
    When I run my webpage the Oracle throws below error.
    " [Macromedia][Oracle JDBC Driver][Oracle]ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'GET_CONTRACT_BY_DYN_SQL' ORA-06550: line 1, column 7: PL/SQL: Statement ignored "
    Calling Code (ColdFusion)
    <cfstoredproc procedure="CONTRACTS_PKG.GET_CONTRACT_BY_DYN_SQL" datasource="#REQUEST.dsn#">
         <cfprocparam cfsqltype="CF_SQL_INTEGER" type="in" value="1" variable="P_CONTRACTID">     
         <cfprocresult name="qDataDynSQL" resultset="1">
    </cfstoredproc>
    <br>Dynamic SQL Query:
    <cfdump var="#qDataDynSQL#" label="Dynamic SQL Query">
    Oracle Package
    create or replace
    PACKAGE CONTRACTS_PKG AS
    TYPE T_CURSOR IS REF CURSOR;
    PROCEDURE GET_CONTRACT_BY_DYN_SQL(P_CONTRACTID IN NUMBER, P_COLS IN VARCHAR2 DEFAULT '*', IO_CURSOR IN OUT T_CURSOR);
    END CONTRACTS_PKG;
    create or replace
    PACKAGE BODY CONTRACTS_PKG AS
    -- Get Contract Using Dynamic SQL
    PROCEDURE GET_CONTRACT_BY_DYN_SQL(P_CONTRACTID IN NUMBER, P_COLS IN VARCHAR2 DEFAULT '*', IO_CURSOR IN OUT T_CURSOR)
    IS
    V_CURSOR T_CURSOR;
    V_SQL VARCHAR2(200);
    BEGIN
    IF p_contractid > 0 THEN
    V_SQL := 'SELECT '|| P_COLS || ' FROM CONTRACTS WHERE contract_id = ' || P_CONTRACTID ;
    ELSE
    V_SQL := 'SELECT '|| P_COLS || ' FROM CONTRACTS';
    END IF;
    OPEN V_CURSOR FOR V_SQL;
    IO_CURSOR := V_CURSOR;
    END GET_CONTRACT_BY_DYN_SQL;
    END CONTRACTS_PKG;
    Does anyone knows why it throws an error? As you can see in the package header & body the parameter P_COLS has the default value as '*'.
    Looking forward to hear from someone.
    Thanks,
    Hitesh Patel

    931198 wrote:
    I have an Oracle Package & it has a stored procedure with optional parameter. The calling code is in ColdFusion.
    When I run my webpage the Oracle throws below error.Never mind the error - your approach is most definitely a candidate for Oracle WTF.
    Nothing sane about this approach. Especially the decision not to use bind variables and slowing down cursor processing significantly by burning a lot more CPU cycles on hard parsing and fragmenting the SQL Shared Pool in the process.
    Why not used MS Access instead? It is far more suited as a mickey mouse database for a goofy application?
    Why am I badmouthing your approach to Oracle? Because that is exactly the primary cause, the #1 reason, for poor Oracle performance and run-time problems dealing with Shared Pool fragmentation. It is something that many Oracle experts blog about, talk about, write about. It is addressed in numerous books, Oracle documentation, and even Oracle Support Notes.
    And despite the amount of information available on how to get the basics rights in using Oracle... this approach you are pursuing still refuses to die. So it deserves to be beaten with a lead pipe when it rears its ugly head here in this forum..

  • Cannot add user throws a error in apex 4.2 of sample demo application admin

    In sample demo of apex 4 which is migrated to apex 4.2 in sample application module in admin section..
    If i add a user
    And at default i dont give a password it throws a error ..
    First go to following link
    [http://apex.oracle.com/pls/apex/f?p=18534:LOGIN:25053108911952]
    and enter user name as admin and pasword as test
    Once when you login click on Tab manage admin user which is on right hand side..
    Now to add a user click on add user button.. add the record and click save..
    It throws a error saying
    1 Error has occured column must have a value..
    How can i remove this error message ? .. Can some one help..
    select
    "USER_ID",
    "USER_NAME",
    "CREATED_ON",
    decode(password, null, 'Set Password', 'Reset Password') rp,
    expires_on,
    admin_user,
    utype
    from "#OWNER#"."DEMO_USERS"
    where user_name != 'ADMIN'
    The above query is used.. and inside it i RP column is culprit since the user has no password..
    Since user has no password it doont save the record.. I checked the table and this column has no not null constraint..
    http://apex.oracle.com/pls/apex/f?p=18534:LOGIN:25053108911952
    Edited by: pauljohny on Nov 27, 2012 12:22 AM
    Edited by: pauljohny on Nov 27, 2012 12:24 AM

    closing the thread its seems working now..Removed some validation issue
    Thanks

  • Passing values to subreport in SSRS throwing an error - Data Retrieval failed for the report, please check the log for more details.

    Hi,
    I have the subreport calling from the main report. The subreport is based on MDX query agianst the SSAS cube. some dimensions in cube has values 0 and 1.
    when I try to pass '0' to the sub report as the parameter value, it gives an error "Data Retrieval failed for the report, please check the log for more details".
    Actually I am using table for storing these parameter values. In the main report I am calling this table (dataset) and passing these values to subreport.
    so I have given like [0],[1] and this works fine. when I give only either [0] or [1] then it is throwing an error.
    Could you please advise on this.
    Appreciate all and any help.
    Thanks,
    Divya

    Hi Divya,
    Based on the current description, I understand that there is no issue if you pass two values from main report to subreport, while the issue occurs when passing one value to subreport.
    To narrow down the issue, I want to confirm whether the subreport can run if there is only [0] or [1] in the subreport. If so, it indicates the query statements exist error in the subreport. If it’s not the case, this shows the issue occurs during passing
    values from main report to subreport. To make further analysis, please post the details of query statements of the subreport to the forum.
    Regards,
    Heidi Duan
    Heidi Duan
    TechNet Community Support

  • Create view throwing an error

    Hello guys, I am trying to create a view from the result set of a sql query. The sql when run independently works fine, but when I try to create a view on it it throws an error saying that the table does not exist. below is the create view I am using.
    create view ops$oracle.pci_view as SELECT
         (select name from v$database@dwdev) database_name,
          (select host_name from v$instance) host_name,
          (select version from v$instance) dbversion,
           o.owner,
           o.object_name table_name,
           o.CREATED table_created,
           o.last_ddl_time table_last_ddl_time,
           t.tablespace_name,
           t.last_analyzed,
           t.partitioned,
           t.num_rows,
           T.COMPRESSION,
           t.compress_for,
           t.read_only,
           tb.status tablespace_status,
           tb.encrypted tablespace_encrypted,
           tb.compress_for tablespace_compress,
           tb.contents,
           TC.COLUMN_NAME,
           tc.data_type,
           TC.DATA_LENGTH,
           tc.data_precision,
           tc.data_scale,
           tc.nullable,
           tc.column_id,
           tc.num_distinct,
           tc.avg_col_len,
           tc.density,
           tc.num_nulls,
           tc.low_value,
           tc.high_value,
           tc.last_analyzed col_last_analyzed,
           ec.encryption_alg,
           ec.salt,
           ec.integrity_alg,
           (SELECT tcm.comments
              FROM dba_tab_comments tcm
             WHERE tcm.owner = T.OWNER AND tcm.table_name = t.table_name)
              table_comments,
           (SELECT ccm.comments column_comments
              FROM dba_col_comments ccm
             WHERE     ccm.owner = TC.OWNER
                   AND ccm.table_name = tc.table_name
                   AND ccm.column_name = tc.column_name)
              column_comments
      FROM dba_objects o,
           dba_tables T,
           dba_tablespaces tb,
              dba_tab_columns tc  
            LEFT JOIN
              dba_encrypted_columns ec      ***********************************************
           ON     ec.owner = TC.OWNER
              AND ec.table_name = tc.table_name
              AND ec.column_name = tc.column_name
    WHERE o.owner NOT IN
              ('APPQOSSYS',
               'DBSNMP',
               'EXFSYS',
               'GGAPP',
               'OPS$ORACLE',
               'ORACLE_OCM',
               'OUTLN',
               'SYS',
               'SYSTEM',
               'WMSYS',
               'XDB')
           AND o.object_type = 'TABLE'
           AND NOT EXISTS
                      (SELECT 1
                         FROM dba_mviews mv
                        WHERE mv.owner = o.owner
                              AND mv.container_name = o.object_name)
           AND t.owner = o.owner
           AND t.table_name = o.object_name
           AND tb.tablespace_name = t.tablespace_name
           AND tc.owner = o.owner
           AND tc.table_name = o.object_name
           AND tc.owner = t.owner
           AND tc.table_name = t.table_name
           AND tc.data_length > 15
           AND tc.data_type NOT LIKE ('TIMESTAMP%')
           AND (tc.data_precision IS NULL OR tc.data_precision > 15);(The line containing the string of astrixes, that is the table that the error says does not exist)
    can someone help me where I am going wrong.
    Thanks

    969224 wrote:
    what if I create the view in SYS for few minutes until i can complete the task i was assigned and after that drop the view I created in SYS schema, would that have any effect on the database?Uh, yeah .. SYS isn't any better an option than SYSTEM.
    Those schemas are "off limits" to us ... ignore them .. pretend they do not exist. (seriously ..)
    Sounds like you need a new schema to store your application objects.

  • Processing a cursor of 11,000 rows and Query completed with errors

    So I have 3rd party data that I have loaded into a SQL Server Table. I am trying to determine if the 3rd party Members reside in our database by using a cursor and going through all 11,000 rows...substituting the #Parameter Values in a LIKE statement...trying
    to keep it pretty broad. I tried running this in SQL Server Management Studio and it chunked for about 5 minutes and then just quit. I kind of figured I was pushing the buffer limits within SQL Server Management Studio. So instead I created it as a Stored
    Procedure and changed my Query Option/Results and checked Discard results after execution. This time it chunked away for 38 minutes and then stopped saying
    Query completed with errors. I did throw a COMMIT in there thinking that the COMMIT would hit and free up resources and I'd see the Table being loaded in chunks. But that didn't seem to work.
    I'm kind of at a loss here in terms of trying to tie back this data.
    Can anyone suggest anything on this???
    Thanks for your review and am hopeful for a reply.
    WHILE (@@FETCH_STATUS=0)
    BEGIN
    SET @SQLString = 'INSERT INTO [dbo].[FBMCNameMatch]' + @NewLineChar;
    SET @SQLString = ' (' + @NewLineChar;
    SET @SQLString = ' [FBMCMemberKey],' + @NewLineChar;
    SET @SQLString = ' [HFHPMemberNbr]' + @NewLineChar;
    SET @SQLString = ' )' + @NewLineChar;
    SET @SQLString = 'SELECT ';
    SET @SQLString = @SQLString + CAST(@FBMCMemberKey AS VARCHAR) + ',' + @NewLineChar;
    SET @SQLString = @SQLString + ' [member].[MEMBER_NBR]' + @NewLineChar;
    SET @SQLString = @SQLString + 'FROM [Report].[dbo].[member] ' + @NewLineChar;
    SET @SQLString = @SQLString + 'WHERE [member].[NAME_FIRST] LIKE ' + '''' + '%' + @FirstName + '%' + '''' + ' ' + @NewLineChar;
    SET @SQLString = @SQLString + 'AND [member].[NAME_LAST] LIKE ' + '''' + '%' + @LastName + '%' + '''' + ' ' + @NewLineChar;
    EXEC (@SQLString)
    --SELECT @SQLReturnValue
    SET @CountFBMCNameMatchINSERT = @CountFBMCNameMatchINSERT + 1
    IF @CountFBMCNameMatchINSERT = 100
    BEGIN
    COMMIT;
    SET @CountFBMCNameMatchINSERT = 0;
    END
    FETCH NEXT
    FROM FBMC_Member_Roster_Cursor
    INTO @MemberIdentity,
    @FBMCMemberKey,
    @ClientName,
    @MemberSSN,
    @FirstName,
    @MiddleInitial,
    @LastName,
    @AddressLine1,
    @AddressLine2,
    @City,
    @State,
    @Zipcode,
    @TelephoneNumber,
    @BirthDate,
    @Gender,
    @EmailAddress,
    @Relation
    END
    --SELECT *
    --FROM [#TempTable_FBMC_Name_Match]
    CLOSE FBMC_Member_Roster_Cursor;
    DEALLOCATE FBMC_Member_Roster_Cursor;
    GO

    Hi ITBobbyP,
    As Erland suggested, you can compare all rows at once. Basing on my understanding on your code, the below code can lead to the same output as yours but have a better performance than cursor I believe.
    CREATE TABLE [MemberRoster]
    MemberKey INT,
    FirstName VARCHAR(99),
    LastName VARCHAR(99)
    INSERT INTO [MemberRoster]
    VALUES
    (1,'Eric','Zhang'),
    (2,'Jackie','Cheng'),
    (3,'Bruce','Lin');
    CREATE TABLE [yourCursorTable]
    MemberNbr INT,
    FirstName VARCHAR(99),
    LastName VARCHAR(99)
    INSERT INTO [yourCursorTable]
    VALUES
    (1,'Bruce','Li'),
    (2,'Jack','Chen');
    SELECT * FROM [MemberRoster]
    SELECT * FROM [yourCursorTable]
    --INSERT INTO [dbo].[NameMatch]
    --[MemberNbr],
    --[MemberKey]
    SELECT y.MemberNbr,
    n.[MemberKey]
    FROM [dbo].[MemberRoster] n
    JOIN [yourCursorTable] y
    ON n.[FirstName] LIKE '%'+y.FirstName+'%'
    AND n.[LastName] LIKE '%'+y.LastName+'%'
    DROP TABLE [MemberRoster], [yourCursorTable]
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Query migration - Variable error

    Hi,
      I'm trying to migrate this query from 3.5 to 7.0 when I get the follwoing error.
    SAP Supplied variable 0S_CTELM(Campiagn Element). I'm using this to restrict a characteristic "Campaign". There is a hierarchy that needs to be in place.
    THis query does not throw any errors in 3.5. I'm also able to execute it in both 3.5 and 7.0 Analyzers.
    However, when I check the query in 7.0 designer, I get the following error.
    [E026(R9E)] Errors: Default Values 'Drilldown characteristic' 'Campaign' are not permitted for display hierarchy '[Hierarchy Name]'.
    Any suggestions?
    Thanks
    S Gopalan

    Maybe there was no key date set for your query in the query properties.

Maybe you are looking for

  • Sub contract

    my client running fg sub contracting  (electro plating )cycle through the MRP after return from vendor with mvt type 105 (543) i check document list with MB51. i found following g/l account effects : SFG consumption for sub contract  account = 602026

  • How to change the name or have no name for an iCloud email alias

    I had MobileMe on the iPhone with alias email addresses and I liked how it didn't attach any "name" to an alias. For example, I had MainUserName, then for aliases I would have [email protected], [email protected], etc. When I sent an email from my iP

  • DOM HTML - FOP

    Hello, I'm not new to Java, but new to using DOM Documents and FOP. Here is my case: I have to make the following object / method: - Take in a stream of HTML (String or whatever). - Process and output a PDF of that HTML. I know I know, FOP is suited

  • Replace function - special characters

    Hi All,        If my column is encountering special characters I would like to replace with blank. Special characters may vary from record to record. Sometimes it is @ sometimes $,!,,$,^,<,&,<,>,?,",{,},+,_,),(. Do we have any function same like repl

  • 3rd Party with stock update

    Hi all, I am trying to setup proces to track SO through process of purchase. Much like 3rd party sales processing w. shipping notification with difference that I need to receive goods on stock not on SO consumption and afterwards to ship it away. I t