Error encounter when calling function in where clause

I have created on e user define function.when i am trying to call in select statement it is working fine but when I try to call in where clause it gives me this
error
The following error has occurred:
ORA-06503: PL/SQL: Function returned without value
ORA-06512: at "KINTANA.COMPARE_DATE", line 33
suggest me possible solution
Thanks Chanda

Hi,
i am trying to call in select statement it is working fine but when I try to call in >>where clause it gives me this I am suspecting the same function call is working fine in SELECT and not in WHERE clause.
Please have a look:
  1  CREATE OR REPLACE FUNCTION f1
  2     RETURN NUMBER IS
  3  BEGIN
  4     return 1;
  5  EXCEPTION
  6     WHEN OTHERS THEN
  7     return -1;
  8* END;
SQL>/
Function created.
SQL>
SQL>SELECT f1 FROM DUAL;
        F1
         1
1 row selected.
SQL>SELECT sysdate FROM dual WHERE 1=f1;
SYSDATE
15-MAY-06
1 row selected.
"afiedt.buf" 10 lines, 140 characters
  1     CREATE OR REPLACE FUNCTION f1
  2        RETURN NUMBER IS
  3     BEGIN
  4     NULL;
  5     EXCEPTION
  6        WHEN OTHERS THEN
  7        return -1;
  8*   END;
  9  /
Function created.
SQL>SELECT f1 FROM dual;
SELECT f1 FROM dual
ERROR at line 1:
ORA-06503: PL/SQL: Function returned without value
ORA-06512: at "AVINASHT.F1", line 7
SQL>SELECT sysdate FROM dual where 1=f1;
SELECT sysdate FROM dual where 1=f1
ERROR at line 1:
ORA-06503: PL/SQL: Function returned without value
ORA-06512: at "AVINASHT.F1", line 7
SQL>DECLARE
  2  a NUMBER ;
  3  BEGIN
  4  a := 0;
  5  a := f1;
  6  END;
  7  /
DECLARE
ERROR at line 1:
ORA-06503: PL/SQL: Function returned without value
ORA-06512: at "AVINASHT.F1", line 7
ORA-06512: at line 5It would be better to understand if you post your function and how you are calling.
Regards

Similar Messages

  • Help:alternate for calling function in where clause

    Hi ,
    In below query i'm calling function in where clause to avoid COMPLETE status records,due to this query taking 700 secs to return result.If i'm remove below function condition it's returning results with in 5 secs.Can you some one advice to any alternate idea for this?
    WHERE mark_status != 'COMPLETE'
    SELECT assessment_school,
      subject,
      subject_option,
      lvl,
      component,mark_status,
      mark_status
      NULL AS grade_status,
      NULL AS sample_status,
      :v_year,
      :v_month,
      :v_formated_date,
      :v_type,
      cand_lang
    FROM
      (SELECT assessment_school,
        subject,
        subject_option,
        lvl,
        programme,
        component,
        paper_code,
        cand_lang,
        mark_entry.get_ia_entry_status(:v_year, :v_month, assessment_school, subject_option, lvl, cand_lang, component, paper_code) AS mark_status
      FROM
        (SELECT DISTINCT ccr.assessment_school,
          ccr.subject,
          ccr.subject_option,
          ccr.lvl,
          ccr.programme,
          ccr.language AS cand_lang,
          ccr.paper_code,
          ccr.component
        FROM candidate_component_reg ccr
        WHERE ccr.split_session_year = :v_year
        AND ccr.split_session_month  = :v_month
        AND EXISTS
          (SELECT 1
          FROM IBIS.subject_component sc
          WHERE sc.year          = ccr.split_session_year
          AND sc.month           = ccr.split_session_month
          AND sc.paper_code      = ccr.paper_code
          AND sc.assessment_type = 'INTERNAL'
          AND sc.subject_option NOT LIKE '%self taught%'
          AND sc.component NOT IN ('PERFORMANCE  PRODUCTION','PRESENTATION WORK','REFLECTIVE PROJECT','SPECIAL SYLLABUS INT. ASSESSMENT')
        AND NVL(ccr.withdrawn,'N') = 'N'
        AND ccr.mark_status       != 'COMPLETE'
        AND EXISTS
          (SELECT 1
          FROM school s
          WHERE s.school_code   = ccr.assessment_school
          AND s.training_school = 'N'
    WHERE mark_status != 'COMPLETE';

    One thing you can test quickly is to put the function call in it's own select ...from dual.
    This might make a difference.
    However, only you can check this, I don't have your tables or data.
    So, what happens if you use:
        paper_code,
        cand_lang,
      (select mark_entry.get_ia_entry_status(:v_year, :v_month, assessment_school, subject_option, lvl, cand_lang, component, paper_code) from dual ) AS mark_status
      FROM
        (SELECT DISTINCT ccr.assessment_school,  --<< is the DISTINCT really needed?
          ccr.subject,
          ccr.subject_option,
    ...Also, try to find out the purpose of that above DISTINCT, is it really needed or is there some join missing?

  • Data Quality vendor-specific error: An error occurred when calling function 'sdq_init_connector ()' in connector ": "(-8) Exception!." Detailed error message: Exception thrown by Java: java.lang.UnsatisfiedLinkError: nio (Not found in com.ibm.oti.vm.boots

    When attempting to create a new Account in siebel integrated with OEDQ the following error occurs.
    ERROR
    Data Quality vendor-specific error: An error occurred when calling function 'sdq_init_connector ()' in connector ": "(-8) Exception!." Detailed error message: Exception thrown by Java: java.lang.UnsatisfiedLinkError: nio (Not found in com.ibm.oti.vm.bootstrap.library.path)(SBL-APS-00118)
    STEPS
    The issue can be reproduced at will with the following steps:
    1) from EDQ director we have imported the EDQ_CDS,EDQ-REFERENCE DATA & EDQ_HISTORICAl DATA packages sucessfully.
    2) Created dnd.param file in SIebel server SDQCOnnector folder.
    3) Copied the libdnd.so file to siebsrvr lib directory(32 bit)
    3) In dnd.param file we have mentioned the javalib file and instllation directory path(<Siebsrvr roo>/dnd/install)
    4) Unzipped the EDQ-Siebel Connector files in dnd/install folder
    5) Copied the dnd.properties file in dnd/install directory and modified it accordingly to point to installed EDQ instance.
    6) Configured the Siebel components for EDQ integration.
    7) Realtime EDQ jobs are running.
    8) Create a new Account
    Env details are
    On : 8.2.2.14 [IP2014] version, Client Functionality
    EDQ 11.1.1.7.4
    IBM JDK 1.7 32 bit
    Using Open UI
    Any Champ have faced this issue and overcame it please let me know the resolution steps. your help is
    Regards
    Monoj Dey
    9007554589

    Hi Monoj,
    A few questions:
    - What OS is Siebel running on?
    - What version of the Siebel connector are you using?
    - Which libdnd.so file are you using?
    - What's the contents of your dnd.parms file?
    thanks,
    Nick

  • Error BT616 when calling function module SXPG_COMMAND_EXECUTE in background

    Hi All,
    We use function module SXPG_COMMAND_EXECUTE with a custom command we defined in SM69 to move files in unix (mv command).
    The function module call has worked fine for almost a year and recently we have been seeing an error (BT616) in our job lob (SM37) when the program is run in background. We have not been able to reproduce the error in foreground mode and it seems to be occuring only periodically in the background. (The appropriate SAP authorization objects where assigned to the batch job ID and the steps on the batch job.) We are in the process of setting up the trace flag and performing analysis on the trace log via ST11 to help identify the issue.
    After perform analysis on SXPG_COMMAND_EXECUTE, the error is occurring when calling function module SAPXPG_END_XPG for exception 2, system failure, yet function module SAPXPG_END_XPG does not exist. I assume this is a program at the operating system level and is just a signature of the parameters to be passed to the operating system program.
    Below is part of the SAP function module SXPG_COMMAND_EXECUTE that is failing.
    * Now we have to wait for the termination of the external
    * command if the caller wants us to.
        IF TERMINATIONWAIT = 'X'.
          CALL FUNCTION 'SAPXPG_END_XPG'
            DESTINATION DESTINATION
            IMPORTING   EXITSTAT = STATUS
                        EXITCODE = EXITCODE
            TABLES      LOG      = LOG
            EXCEPTIONS  COMMUNICATION_FAILURE = 1 MESSAGE MSG
                        SYSTEM_FAILURE        = 2 MESSAGE MSG.
    I performed a where used on function module SXPG_COMMAND_EXECUTE, and most of SAP programs call the function module with the parameter TERMINATIONWAIT = 'X', so I assume we should pass ‘X’ as well.
    Any ideas on what could be causing this issue?
    Mike Vondran

    I also remember I have this kind of issue, as I have some UNIX script at OS( UNIX) level . The problem was with the ID , as it don’t have proper authorization at OS level ( UNIX ) . Please check this ID authorization. This could be the one of reasons if you’re sure from SAP standpoint.
    Hope this’ll give you some guide line..
    Thanks
    Bye

  • Calling function in where clause

    <BR>
    Hi
    I receive a string of form '333,444,55R5,B342,A556' as string value which should be passed to condition check to filter records in where clause of query.
    to make string form in right format with proper quotes separated i have written one function which does that job
    CREATE OR REPLACE FUNCTION DW.F_TASK(P_VAL VARCHAR2) RETURN VARCHAR2 AS
    V_VAL VARCHAR2(4000);
    V_VAL1 VARCHAR2(4000);
    BEGIN
    V_VAL1:=REPLACE(P_VAL,',',''',''');
    V_VAL:='('||''''||V_VAL1||''''||')';
    DBMS_OUTPUT.PUT_LINE(V_VAL);
    RETURN V_VAL;
    END F_TASK;
    When i fire below query it doesnt give me output
    SELECT * FROM CONTRACT_TABLE WHERE
    CONTRACT_NUMBER IN F_TASK('333,444,55R5,B342,A556');
    when i fire below query
    SELECT F_TASK('333,444,55R5,B342,A556') FROM DUAL
    below is the output
    ('333','444','55R5','B342','A556')
    note: above output holds quotes now.
    Issue: when i pass paratmeters directly to funciton then i could see output with brackets but when i use same funciton with parameters iin query i dont see data afer firing the query.. though i have those contract numbers in the table.
    Please help how to acquire this
    Thanks,
    Naren
    </BR>

    You haven't described your problem clearly (see: {message:id=9360002})
    However, it sounds like you want a varying IN list, which is also in the FAQ: {message:id=9360009}

  • Error 'operation_no_authorization' when calling function 'SO_OBJECT_DELETE'

    Hello all,
    I am read the inbox content and after proccessing the mail i need to delete it.
    I get 'operation_no_authorization'  error.
    which authorization is needed?

    Hello,
    I run FM 'SO_OBJECT_DELETE' on a user that has authorization of SAP_ALL and i still get error operation_no_authorization.
    How can it be?
    Thanks
    Moshe

  • Strange errors when using user defined function in where clause

    Hello,
    I am having trouble with a function that, when used in the where clause of a select will cause an error if the first column selected is of type INTEGER. Not sure whether I am doing something wrong or whether this is a bug.
    Here is a very simple test case:
    create table test(
    col1 integer not null,
    col2 varchar(20) ascii default ''
    insert into test values(1,'2011-03-15 05:00:00')
    insert into test values(2,'2011-03-15 07:00:00')
    CREATE FUNCTION BTR_TAG  RETURNS VARCHAR AS
        VAR ret VARCHAR(20);
      SET ret='2011-03-15 06:00:00';
      RETURN ret;
    Select * from test where col2 >= BTR_TAG()
    Select col1,col2 from test where col2 >= BTR_TAG()
    =>  Error in assignment;-3016 POS(1) Invalid numeric constant
    Select '',* from test where col2 >= BTR_TAG()
    Select col2,col1 from test where col2 >= BTR_TAG()
    => works as it should
    MaxDB V 7.7.07.16 running on Windows Server 2003
    I can replicated the test case above with Sql Studio and other ODBC based tools.
    Thanks in advance,
    Silke Arnswald

    Hello Siva,
    sorry, but I don't understand your reply:
    This is not right forum to posting this question.
    You are from which module or working any 3rd party application.
    MaxDB 7.7.07.16 is the community version of MaxDb,
    we are not using it for SAP
    and no 3rd party software is required to reproduce my problem,
    Sql Studio or Database Studio will do.
    Regards,
    Silke Arnswald

  • Bad performance when calling a function in where clause

    Hi All,
    I have a performance problem when executing a query that contains a function call in my where clause.
    I have a query with some joins and a where clause with some regular filters. But one of these filters is a function, and its input parameters are columns of the tables used in the query.
    When I run it with only a few rows in the tables, it goes ok. But as the number of rows grows, performance falls geometrically, even when my where clause filters the result to only a few rows.
    If I take the function call off of the where clause, then run the query and then call the function for each returned row, performance is ok. Even when the number of returned rows is big.
    But I need the function call to be in the where clause, because I can't build a procedure to execute it.
    Does anyone have any clue on how to improve performance?
    Thanks,
    Rafael

    You have given very little information...
    >
    If I take the function call off of the where clause, then run the query and then call the function for each returned row, performance is ok. Even when the number of returned rows is big. Can you describe how you measured the performance for a big result set without the function? For example lets say there had been 10.000 rows returned (which is not really big, but it is astarting point). Did you see all 10.000 rows? A typical mistake is to execute the query in some tool like Oracle SQL Developer or TOAD and measure how fast the first couple of rows are returned. Not the performance of the full select.
    As you can see from this little detail there are many questions that you need to address first before we can drill down to the root of your problem. Best way is to go through the thread that Centinul linked and provide all that information first. During the cause of that you might discover that you learn things on the way that help a lot for later tuning problems/approaches.
    Edited by: Sven W. on Aug 17, 2009 5:16 PM

  • I am trying to generate purchase order and i create a BAPI also which is active. But when i call the BAPI from SYbase Mobile Object RFC then after calling it gives an Error "Conflict when calling a Function Module (Field Length)".

    i am trying to generate purchase order and i create a BAPI also which is active.
    But when i call the BAPI from SYbase Mobile Object RFC then after calling it gives an Error "Conflict when calling a Function Module (Field Length)".

    Hi,
    Yeah i tried my Z_BAPI in R3 and then giving some ERROR.
    This is my CODE-
    FUNCTION ZBAPIPOTV2.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(POHD) TYPE  ZPOHD OPTIONAL
    *"     VALUE(POITEM) TYPE  ZPOITEM OPTIONAL
    *"  TABLES
    *"      RETURN STRUCTURE  BAPIRET1 OPTIONAL
    data: ls_pohd type bapimepoheader,
             ls_pohdx TYPE bapimepoheaderx,
             lt_poit TYPE TABLE OF bapimepoitem,
             lt_poitx TYPE TABLE OF bapimepoitemx,
             ls_poit TYPE bapimepoitem,
             ls_poitx TYPE bapimepoitemx.
       MOVE-CORRESPONDING pohd to ls_pohd.
       MOVE-CORRESPONDING poitem to ls_poit.
       ls_pohdx-comp_code = 'x'.
       ls_pohdx-doc_type = 'x'.
       ls_pohdx-vendor = 'x'.
       ls_pohdx-purch_org = 'x'.
       ls_pohdx-pur_group = 'x'.
       ls_poit-po_item = '00010'.
       APPEND ls_poit to lt_poit.
       ls_poitx-po_item = '00010'.
       ls_poitx-po_itemx = 'x'.
       ls_poitx-material = 'x'.
       ls_poitx-plant = 'x'.
       ls_poitx-quantity = 'x'.
       APPEND ls_poitx to lt_poitx.
    CALL FUNCTION 'BAPI_PO_CREATE1'
       EXPORTING
         POHEADER                     = ls_pohd
        POHEADERX                    =  ls_pohdx
    *   POADDRVENDOR                 =
    *   TESTRUN                      =
    *   MEMORY_UNCOMPLETE            =
    *   MEMORY_COMPLETE              =
    *   POEXPIMPHEADER               =
    *   POEXPIMPHEADERX              =
    *   VERSIONS                     =
    *   NO_MESSAGING                 =
    *   NO_MESSAGE_REQ               =
    *   NO_AUTHORITY                 =
    *   NO_PRICE_FROM_PO             =
    *   PARK_COMPLETE                =
    *   PARK_UNCOMPLETE              =
    * IMPORTING
    *   EXPPURCHASEORDER             =
    *   EXPHEADER                    =
    *   EXPPOEXPIMPHEADER            =
      TABLES
        RETURN                       = return
        POITEM                       = lt_poit
        POITEMX                      = lt_poitx
    *   POADDRDELIVERY               =
    *   POSCHEDULE                   =
    *   POSCHEDULEX                  =
    *   POACCOUNT                    =
    *   POACCOUNTPROFITSEGMENT       =
    *   POACCOUNTX                   =
    *   POCONDHEADER                 =
    *   POCONDHEADERX                =
    *   POCOND                       =
    *   POCONDX                      =
    *   POLIMITS                     =
    *   POCONTRACTLIMITS             =
    *   POSERVICES                   =
    *   POSRVACCESSVALUES            =
    *   POSERVICESTEXT               =
    *   EXTENSIONIN                  =
    *   EXTENSIONOUT                 =
    *   POEXPIMPITEM                 =
    *   POEXPIMPITEMX                =
    *   POTEXTHEADER                 =
    *   POTEXTITEM                   =
    *   ALLVERSIONS                  =
    *   POPARTNER                    =
    *   POCOMPONENTS                 =
    *   POCOMPONENTSX                =
    *   POSHIPPING                   =
    *   POSHIPPINGX                  =
    *   POSHIPPINGEXP                =
    *   SERIALNUMBER                 =
    *   SERIALNUMBERX                =
    *   INVPLANHEADER                =
    *   INVPLANHEADERX               =
    *   INVPLANITEM                  =
    *   INVPLANITEMX                 =
    ENDFUNCTION.
    i am trying to generate purchase order and i create a BAPI also which is active. But when i call the BAPI from SYbase Mobile Object RFC then after calling it gives an Error "Conflict when calling a Function Module (Field Length)". 

  • Why do I get Error -1073807343 when calling the open visa function ?

    Hello,
    I am running a Labview 6i under Linux (kernel 2.4) and I have Error -1073807343 when calling the open visa function. I have verified the name of the session (GPIB0::9::INSTR), and I can communicate with my instruments with ibic.
    More informations : I use NIVISA 2.5 and nigpib-0.8.2. I have downloaded the lastest drivers of my instruments but it doesn't work better.
    Thanks very much for your help.

    We've had several NI-VISA releases since 2.5 - so I suggest you upgrade to NI-VISA 3.0. While there isn't anything specific to your type of problem in the Linux version of our readme.txt, I know we've made a number of other fixes.
    While the most recent release is NI-VISA 3.1, I still recommend you upgrade only to 3.0.
    This is because NI-VISA 3.1 requires the new NI-488.2 release for GPIB-ENET to be installed (even though you aren't using that product). This is due to some internal rearchitectures, and the PCI-GPIB product is not released. If you do want to go with NI-VISA 3.1, the new NI-488.2 release for GPIB-ENET on Linux will still work with the PCI-GPIB beta driver that you have installed.
    Dan Mondrik
    National Instruments

  • My function in where clause? help me please.

    hello friends, I need to call my function in where clause as dummy example below:
    declare
    name_ table1.name%type;
    function return_id(id number) return number is
    begin
    return 1;
    end return_id;
    begin
    select name into name_
    from table1
    where id = return_id(table1.id);
    end;
    raise exception: 'the function doesn't used in where clause'. why????

    -- CREATING A FUNCTION AVAILABLE THROUGH A PACKAGE SPEC.
    SQL> ed
    Wrote file afiedt.buf
      1  create package mypackage is
      2    function myfunc(p_val NUMBER) RETURN NUMBER;
      3* end;
    SQL> /
    Package created.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace package body mypackage is
      2    function myfunc(p_val NUMBER) RETURN NUMBER IS
      3    begin
      4      RETURN (p_val*p_val)-1;
      5    end;
      6* end;
    SQL> /
    Package body created.
    SQL> declare
      2    v_myval NUMBER := 2;
      3  begin
      4    select mypackage.myfunc(v_myval)
      5    into   v_myval
      6    from   dual;
      7    dbms_output.put_line(v_myval);
      8    select mypackage.myfunc(v_myval)
      9    into   v_myval
    10    from   dual;
    11    dbms_output.put_line(v_myval);
    12  end;
    13  /
    3
    8
    PL/SQL procedure successfully completed.
    -- CREATING A STANDALONE DATABASE FUNCTION.
    SQL> create or replace function myfunc2(p_val number) return number is
      2  begin
      3    return (p_val*2)+1;
      4  end;
      5  /
    Function created.
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    v_myval NUMBER := 2;
      3  begin
      4    select myfunc2(v_myval)
      5    into    v_myval
      6    from dual;
      7    dbms_output.put_line(v_myval);
      8    select myfunc2(v_myval)
      9    into    v_myval
    10    from dual;
    11    dbms_output.put_line(v_myval);
    12* end;
    SQL> /
    5
    11
    PL/SQL procedure successfully completed.
    -- CREATING A LOCAL FUNCTION IN THE ANONYMOUS PL/SQL BLOCK
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    v_myval NUMBER := 2;
      3    function myfunc3(p_val number) return number is
      4    begin
      5      return (p_val*p_val*p_val);
      6    end;
      7  begin
      8    select myfunc3(v_myval)
      9    into    v_myval
    10    from dual;
    11    dbms_output.put_line(v_myval);
    12    select myfunc3(v_myval)
    13    into    v_myval
    14    from dual;
    15    dbms_output.put_line(v_myval);
    16* end;
    SQL> /
      select myfunc3(v_myval)
    ERROR at line 8:
    ORA-06550: line 8, column 10:
    PLS-00231: function 'MYFUNC3' may not be used in SQL
    ORA-06550: line 8, column 10:
    PL/SQL: ORA-00904: : invalid identifier
    ORA-06550: line 8, column 3:
    PL/SQL: SQL Statement ignored
    ORA-06550: line 12, column 10:
    PLS-00231: function 'MYFUNC3' may not be used in SQL
    ORA-06550: line 12, column 10:
    PL/SQL: ORA-00904: : invalid identifier
    ORA-06550: line 12, column 3:
    PL/SQL: SQL Statement ignored
    SQL>As you can see (and as previously mentioned by someone else) the function has to be available to the SQL engine either via a datavbase package or as a database function. If you declare the function locally within the anonymous PL/SQL block then the function only exists in the scope of that PL/SQL block and thus when your SQL statement is sent to the SQL engine for execution, the SQL engine can't see it.
    ;)

  • Using round off function in where clause

    Hi All,
    I'm trying to use round off function in where clause, I seek help in completing this script.
    WITH CR_Details AS
    (Select
    request_id,
    parent_request_id,
    fcpt.user_concurrent_program_name Request_Name, phase_code, status_code,
    round((fcr.actual_completion_date - fcr.actual_start_date),3) * 24 * 60 as Run_Time,
    round(avg(round(to_number(actual_start_date - fcr.requested_start_date),3) * 1440),2) wait_time,
    fu.User_Name Requestor,
    fcr.argument_text parameters,
    to_char (fcr.requested_start_date, 'MM/DD HH24:mi:SS') requested_start,
    to_char(actual_start_date, 'MM/DD/YY HH24:mi:SS') ACT_START,
    to_char(actual_completion_date, 'MM/DD/YY HH24:mi:SS') ACT_COMP,
    fcr.completion_text
    From
    apps.fnd_concurrent_requests fcr,
    apps.fnd_concurrent_programs fcp,
    apps.fnd_concurrent_programs_tl fcpt,
    apps.fnd_user fu
    Where 1=1
    and fcr.concurrent_program_id = fcp.concurrent_program_id
    and fcp.concurrent_program_id = fcpt.concurrent_program_id
    and fcr.program_application_id = fcp.application_id
    and fcp.application_id = fcpt.application_id
    and fcr.requested_by = fu.user_id
    and fcpt.language = 'US'
    and fcr.actual_start_date like sysdate )
         select crd.*
         from CR_Details crd
         where Run_time <> '0'
         AND wait_time <> '0'
    GROUP BY
    crd.request_id,
    crd.parent_request_id,
    crd.fcpt.user_concurrent_program_name,
    crd.requested_start_date,
    crd.User_Name,
    crd.argument_text,
    crd.actual_completion_date,
    crd.actual_start_date,
    crd.phase_code,
    crd.status_code,
    crd.resubmit_interval,
    crd.completion_text,
    crd.resubmit_interval,
    crd.resubmit_interval_unit_code,
    crd.description
    Not sure about the GROUPBY function referencing the "crd." .

    Hi,
    The best thing for you to do is start over. Start as small as possible, then take baby steps.
    Pick one of the tables; fcr perhaps, and write a query that just uses that table, like this:
    SELECT    *
    FROM       apps.fnd_concurrent_requests     fcr
    WHERE       fcr.actual_start_date          >= TRUNC (SYSDATE)
    AND       fcr.actual_start_dt          <  TRUNC (SYSDATE) + 1
    ;(I think this is what you meant to do when you said "... LIKE SYSDATE".)
    Make sure this little query gets credible results. When that tiny query is working perfectly, add another line or two. You can cut and paste code from what you posted, if that helps you.
    If you get stuck, post the last version of your code that worked perfectly, and the latest version (only a line or two bigger) that has the problem. Describe what the problem is. If you get an error, post the complete error message. In any event, post CREATE TABLE and INSERT statements for all the tables and columns needed to run the query, and the results you want to get from that query.
    When you post any code, format it, so that how the code looks on the screen gives some clues about how it is working.
    When you post any formatted text on this site, type these 6 characters:
    \(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
    If you going to use the AVG function in the sub-query, then you probably need to do a GROUP BY in the sub-query.
    If you're not using any aggregate functions (like AVG) in the main query, then you probably don't want to do a GROUP BY in the main query.
    I know this is a lot of work.  I'm sorry.  If there was an easier way, I wouldn't ask you to do all this.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Oracle stored functions and where clauses

    Hello everybody,
    I need to call an Oracle stored function and at the same time do a select on
    the result of the query, it works well except when I use a where clause. I
    am connecting to Oracle 8.1.7 through OLEDB using the Oracle provider for
    OLEDB distributed with this Oracle version.
    Here is the query I am doing:
    select * from {call MC.SEC.QryTermbases(?, ?) where ID = ?}
    If I remove the where clause it works well but I need to use the where. I
    know that I could pass the parameter to the procedure instead of doing that
    in the select but there are places where I can not do that since the SQL
    query is generated dynamically. The code above is just a demo.
    Thanks very much for your help,
    Jose.

    Thanks for answering, it is actually possible to do a select on the return of a function, I have tested it with other than "select *" and it has worked well. What has not worked for me is using a "where" clause. That is "select" without "where" has worked but not with the "where".
    I also suspect that it does not work but similar queries work well in MSSQL 2000 and Interbase 6.0 so I thought may be there was a way to do that with Oracle. That is in MSSQL I can treat the result of a function as a normal table and I can do the same thing with a stored procedure that returns a recordset in Interbase.
    Thanks again for answering,
    Jose.

  • Clarification on using function in where clause of oracle sql query

    I have an issue in regarding function using where clause of sql query..
    We are facing performance issue while executing query, so in what ways to improve the performance of the query which i have posted below.
    select col ,case when my_function(parameter)
    from tab1 a ,tab2 b,tabl3 c
    where a.column1=b.column2
    and b.column3 =c.column6
    and my_function(parameter)>0
    Regards
    Dinesh
    Edited by: wild fire on May 18, 2012 4:15 PM

    Dinesh,
    remind that when you use a function in the where clause it normally will get started for each record in the table.
    So your answer is two-fold:
    1. make the function only start when needed by adding a function based index on the table (this will make inserts and updates slower)
    2. make the function faster by adding the DETERMINISTIC clause if possible. this will make Oracle "cache" the result of the function.
    Regards,
    Richard
    blog: http://blog.warp11.nl
    twitter: @rhjmartens
    If this question is answered, please mark the thread as closed and assign points where earned..

  • Can't have aggregate function in WHERE clause clause

    Dear all,
    I've created object in BO XI 3.1 Designer with following criterias:
    http://img4.imageshack.us/img4/833/20111201124314.th.jpg
    It is a simple number - 1,2,3,4,5.
    Now I need to use this object as a criteria for WHERE function in another object.
    http://img607.imageshack.us/img607/1543/20111201124717.th.jpg
    I receive an error "Can't have aggregate function in WHERE clause <clause>"
    How can I overcome this?
    P.S. I'm sorry in advance if such topic already exist - I didn't found one.
    Edited by: Ashot Antonyan on Dec 1, 2011 9:50 AM
    Edited by: Ashot Antonyan on Dec 1, 2011 9:51 AM

    Hi,
    You will have to use Sub query to achieve this. Give more details on what is available and what you need then i could help you out with the complete solution.
    Thanks,
    Ravichandra K

Maybe you are looking for

  • Personal File sharing doesn't work

    I'm trying to transfer files from my G4 to my G5. I've been successful until now. All of a sudden my G4 will not allow me to enable Personal File Sharing. I click the "Start now" button, and nothing. I have also been having start-up and sleep problem

  • How do I create a Disk Image of a FILE?

    How do I get Disk Utility to make a .dmg (regular or encrypted) of a single FILE, not a Folder, Disk or Device, without using a third party utility? OR are 3rd party utiities a better choice for Disk Image creation? I've read all the "Help" info and

  • Positioning a swf inside a DIV

    Hi everybody, I am redoing a site for a friend, which was originally done using frames in GoLive. The site is very siimple but I can't figure out how to positoin the menu that I've placed inside the navbar DIV along the left side. I want it to stay p

  • I lost over 50 samples in ibooks, how do I get them back

    I have lost all my samples in ibooks, over 50.  And only have a few of the ones I actually purchased.  Also have no book cover photos, just titles

  • Rotate 3D interfering with state reset?  *help*

    I have several shapes (in photoshop) that transition between states... size, location, opacity, etc. One of the shapes has a manually applied action "Rotate 3D" on the transition from State 1 -> State 2. I have 2 buttons.  A "Next Button" that moves