Select statement inside function with  into keyword

Hi Everyone,
i have a function which contains a select statement
create or replace
function fun_1(Table_Name1 in varchar2)
RETURN VARCHAR2
is
VAR_GEN_TYPE NUMBER(10);
TA_U varchar2(256);
VAR_DATA_FLAG varchar2(1);
begin
select T.FLAG into VAR_GEN_TYPE ,T.DATA_UID_GEN_TYPE into VAR_DATA_FLAG  from T_DYNAMIC_TABLE T  where T.TABLE_NAME=TABLE_NAME1;
end
whene ever i am executing this function giving error message: From Keyword  Not Found
when i change select statement to
select T.FLAG ,T.DATA_UID_GEN_TYPE into VAR_DATA_FLAG, VAR_GEN_TYPE from T_DYNAMIC_TABLE T where T.TABLE_NAME=TABLE_NAME1;
then it is working
why first statements will not work ?
i.e.,
select T.FLAG into VAR_GEN_TYPE ,T.DATA_UID_GEN_TYPE into VAR_DATA_FLAG from T_DYNAMIC_TABLE T where T.TABLE_NAME=TABLE_NAME1;
why in select statement we cannot use into keyword more than one time ?
Edited by: karteek on Jun 7, 2012 4:23 AM
Edited by: karteek on Jun 7, 2012 4:24 AM

select T.FLAG into VAR_GEN_TYPE ,T.DATA_UID_GEN_TYPE into VAR_DATA_FLAG, from T_DYNAMIC_TABLE T where T.TABLE_NAME=TABLE_NAME1;
into should be only once..
the syntax should be
select <column list>
into
<variable list>
from <table name> where <condition>
--This query shuold return only one row.
column list count and variable list count should match
there should be no comma after last variable.andbefore from.

Similar Messages

  • Need help in logic change to avoid select statement inside loop .

    Hello all ,
    Please see the below code . Here i got the shipment number in internal table  IT_VTTK . So For this shipment number i want to get the details from Vekp table in to internal table  IT_VEKP  . There is no need for me to use For all entries . I have passed the value of it_vekp into work area wa_vekp and getting the details in to IT_vekp using loop.
    But since we should not use the select statement inside the loop , Can anybody please tell me how to achieve this functionality .
    Instead of passing into work area wa_vttk if i directly use the internal table I'm getting the following error .
    "IT_VTTK" is a table without a header line and therefore has no component called "TKNUM".
    Hence i have used select statement inside a loop . Please tell me is there any other way to avoid this ?
    types:begin of ty_likp,
            vbeln type likp-vbeln,
           end of ty_likp,
           begin of ty_vttk,
            tknum type vttk-tknum,
            end of ty_vttk.
    DATA: IT_VEKP TYPE STANDARD TABLE OF TY_VEKP,
          WA_VEKP TYPE TY_VEKP.
      data:it_likp type standard table of ty_likp,
           wa_likp type ty_likp,
           it_likp1 type standard table of ty_likp,
           it_vttk type standard table of ty_vttk,
           wa_vttk type ty_vttk.
      data:w_tknum type vttk-tknum.
    if not it_likp is initial .
        select vbeln
                from
                 vbfa
          into table it_vttk
           for all entries in it_likp where vbelv = it_likp-vbeln and vbtyp_n = '8'.
      endif .
    IF IT_VTTK[] IS NOT INiTIAL.
        loop at it_vttk into wa_vttk.
        SELECT venum
               EXIDV
               EXIDV2
               BRGEW
               NTGEW
               GEWEI
               TARAG
               GEWEI
               VHART
               INHALT
             FROM VEKP INTO TABLE IT_VEKP where VPOBJKEY = wa_vttk-tknum  and vpobj = '4'.
          endloop.
          endif.

    Hello,
    Why would you not like to use FOR ALL ENTRIES in the second select? Is it becasue of the length or type mismatch error between the fields VPOBJKEY and wa_vttk-tknum ?
    Vikranth

  • Select statements inside a SQL Expression field

    Hello
    Why cannot we use the Select statements inside a SQL expression field in Crystal Reports ?
    Any alternatives for this...
    SELECT Top(1) "SomePrivateDatabase"."SPDname" FROM "SomePrivateDatabase"
    inner join "Subscriber" on
    "Subscriber"."SPDID" = "SomePrivateDatabase"."SPDID"
    inner join "UserDetails" on
    "UserDetails"."SPDID" = "SubscriberCore"."SPDID"
    Regards
    Srivatsa
    Edited by: Srivatsa Haridas on Dec 3, 2008 12:17 PM

    Hi Srivatsa,
    SQL Expressions is something the Database supports. We query the Client engine for a list of functions they make available. If the SQL Statement is not list it's not an option and therefore it won't work.
    Your work arounds are to use either a Stored Procedure, this is the most efficient way, all processing is done server side and CR simply waits for the data to format in the report. Another option is to use a
    Command Object, use one CO per report so try to get all data within the SQL statement. We simply pass the SQL to the server and wait for the result set, if you get an error it will be the SQL you typed in. Test in a SQL test tool first to confirm you are getting the data correctly.
    For more assistance in designing reports please post your report deisgn questions to the Reprot Design forums. I am moving this one to that queue.
    Thank you
    Don

  • Fetching a value from a select statement inside select clause

    hello all,
    I have a problem executing a procedure it gives me a runtime error, what am doing is i have multiple select statement inside a select clause. am using the entire select statement for a ref cursor. when running the query seperately am able to get the records but it's not getting compiled.
    here is the piece of code which am working with
    create or replace procedure cosd_telecommute_procedure
    (p_from_date in date,
    p_to_date in date,
    p_rset in out sys_refcursor)
    as
    p_str varchar2(10000);
    begin
    p_str := 'select personnum, '||
    'fullname, '||
                   'personid, '||
         'hours, '||
         'applydtm, '||
    'paycodeid, '||
         'laborlev2nm, '||
         'laborlev3nm, '||
         'laborlev2dsc, '||
    'adjdate, '||
         'timeshtitemtypeid, '||
         '(select max(eff_dt) from cosd_telecommute_info_tbl '||
         'where emplid = cosd_vp_telecommute.personnum and '||
    'eff_dt between ''01-aug-2005'' and ''30-aug-2005'') thisyreffdt, '||
                   '(select elig_config7 from cosd_telecommute_info_tbl '||
                   'where emplid = cosd_vp_telecommute.personnum and '||
    'eff_dt = (select max(eff_dt) from cosd_telecommute_info_tbl '||
                   'where emplid = cosd_vp_telecommute.personnum and '||
    'eff_dt between ''01-aug-2005'' and ''30-aug-2005'')) thisyrmiles,'||
    '(select max(eff_dt) from cosd_telecommute_info_tbl '||
                   'where emplid = cosd_vp_telecommute.personnum and '||
    'eff_dt between trunc(p_from_date) and trunc(p_to_date)) fiscalyreffdt, '||
         '(select elig_config7 from cosd_telecommute_info_tbl '||
                   'where emplid = cosd_vp_telecommute.personnum and '||
    'eff_dt = (select max(eff_dt) from cosd_telecommute_info_tbl '||
                        'where emplid = cosd_vp_telecommute.personnum and '||
    'eff_dt between trunc(p_from_date) and trunc(p_to_date))) fiscalyrmiles '||
    'from cosd_vp_telecommute '||
    'where trunc(applydtm) '||
    'between p_from_date and p_to_date '||
                   'and personnum = ''029791''';
                   open p_rset for p_str;
    end cosd_telecommute_procedure;
    and here is the piece of error am getting
    ERROR at line 1:
    ORA-00904: invalid column name
    ORA-06512: at "TKCSOWNER.COSD_TELECOMMUTE_PROCEDURE", line 40
    ORA-06512: at line 5

    Did you run the query in SQL plus? Check whether all the column are valid in your database. Below is the query which i got from your procedure just run and check it out. It is really hard for us to tell you the problem without knowing the table structure
    select personnum, fullname, personid, hours, applydtm, paycodeid, laborlev2nm, laborlev3nm,
    laborlev2dsc, adjdate, timeshtitemtypeid,
    (select max(eff_dt) from cosd_telecommute_info_tbl
      where emplid = cosd_vp_telecommute.personnum
      and eff_dt between '01-aug-2005' and '30-aug-2005') thisyreffdt,
      (select elig_config7 from cosd_telecommute_info_tbl where emplid = cosd_vp_telecommute.personnum
      and eff_dt = (select max(eff_dt)
                    from cosd_telecommute_info_tbl
                    where emplid = cosd_vp_telecommute.personnum
                    and eff_dt between '01-aug-2005' and '30-aug-2005'
       ) thisyrmiles,
      (select max(eff_dt)
       from cosd_telecommute_info_tbl
       where emplid = cosd_vp_telecommute.personnum
       and eff_dt between trunc(p_from_date) and trunc(p_to_date)
       ) fiscalyreffdt,
       (select elig_config7 from cosd_telecommute_info_tbl where emplid = cosd_vp_telecommute.personnum
       and eff_dt = (select max(eff_dt)
                     from cosd_telecommute_info_tbl
                     where emplid = cosd_vp_telecommute.personnum
                     and eff_dt between trunc(p_from_date) and trunc(p_to_date)
       ) fiscalyrmiles
    from cosd_vp_telecommute
    where trunc(applydtm) between p_from_date and p_to_date
    and personnum = '029791'

  • Benefit of using store procedure instead of select statement to pull data into biztalk

    I was wondering why store procedure is more beneficial than using select statement to pull data into biztalk?

    In addition to the above two points, in case if there is a change in logic of stored procedure, you only need to modify the stored proc and the applications calling/using it may be left intact.
    Also, stored procedures are complied code so performance is better and safe too.
    Thanks,
    Prashant
    Please mark this post accordingly if it answers your query or is helpful.

  • How to insert variable value using select statement - Oracle function

    Hi,
    I have a function which inserts record on basis of some condition
    INSERT INTO Case
    Case_ID,
    Case_Status,
    Closure_Code,
    Closure_Date
    SELECT newCaseID,
    caseStatus,
    Closure_Code,
    Closure_Date,
    FROM Case
    WHERE Case_ID = caseID
    Now i want new casestatus value in place of select statement caseStatus value. I have a variable m_caseStatus and i want to use the value of this variable in above select statement.
    how can i use this.
    thanks

    Hi,
    I have a function which inserts record on basis of some condition
    INSERT INTO Case
    Case_ID,
    Case_Status,
    Closure_Code,
    Closure_Date
    SELECT newCaseID,
    caseStatus,
    Closure_Code,
    Closure_Date,
    FROM Case
    WHERE Case_ID = caseID
    Now i want new casestatus value in place of select statement caseStatus value. I have a variable m_caseStatus and i want to use the value of this variable in above select statement.
    how can i use this. Do not select Case_Status from inner select, so null will be inserted then after inserting it update the case status with m_caseStatus.
    Regards.

  • Select statement as function parameter

    Hi everyone, hopefully this is a quick yes or no.
    I'm getting an annoying error in toad with a statement, basically I want to call a function with a select statement as a parameter.
    my_function((select name from people)), 1, 10, xx)
    Can I use a select statement in this context?
    Regards,
    Kieran

    SELECT TO_CHAR ((SELECT SYSDATE
                       FROM DUAL), 'mm/dd/yyyy')
      FROM DUAL
    01/09/2008                                                                                                                                                                                                                               

  • Select Statement or Function Module

    Hi all,
    I have lakhs of records in my database.When I am using the SAP standard function module C1F2_SUBSTANCES_READ for retreiving data it is taking time.I know all the data base tables .Shall I use to retreive data using select statements instead of the mentioned SAP standard function module.Could any one please explain which is best method to retrieve huge data and also explain reason?
    Thanks and Regards,
    Kanth

    Hi Shiva,
    If your Sure about exactly what data you want to fetch from the database, I would follow the below process.
    1) I would search if there is any standard function module or Bapi to do this... The reason why i do this is becuase as SAP has created those standard function modules or Bapi, the first advantage would be the program has good performance ( Moreever it also depends on how do you handle that in your program ).
    Moreover it handles varies business functionalities and authorizatiions etc..
    2)  If i dont find any standard function module or Bapi then if the data what you are selecting from database if it is used multiple times then i would create a zbapi or Zfunctionmodule and inlude my code in it... ( Here this custom function module can be used in many program : ie : modulerization ).
    Regards
    Satish Boguda

  • Group By Select Statement aggregate function error.

    I am using Dreamweaver MX4 and have an ASP web page. I can easily do this in Access 2007 a simple "group by" sum totals statement.
    Why can I not get this to work on a web page? Are the "#" signs messing this up in the Code2 Select Statement?
    How can I get Code2 to work correctly? Code1 works fine. A user enters the customer and a date range on a form and submits request. I get error message in Dreamweaver. You tried to execute a query where the specified expression field3 is not part of an aggregate function
    Code1. This works fine SELECT Field3, Field10, SUM(Field16) as SumofField16 FROM CustomerHistory_CP WHERE Field3 LIKE '%Search_Criteria%' AND Field6 >= #1/2/09# AND Field6 <= #1/30/09#  GROUP BY Field3, Field10
    Code2. I get error message SELECT Field3, Field10, SUM(Field16) as SumofField16 FROM CustomerHistory_CP WHERE Field3 LIKE '%Search_Criteria%' AND Field6 >= #Date1# AND Field6 <= #Date2#  GROUP BY Field3, Field10

    I am using Dreamweaver MX4 and have an ASP web page. I can easily do this in Access 2007 a simple "group by" sum totals statement.
    Why can I not get this to work on a web page? Are the "#" signs messing this up in the Code2 Select Statement?
    How can I get Code2 to work correctly? Code1 works fine. A user enters the customer and a date range on a form and submits request. I get error message in Dreamweaver. You tried to execute a query where the specified expression field3 is not part of an aggregate function
    Code1. This works fine SELECT Field3, Field10, SUM(Field16) as SumofField16 FROM CustomerHistory_CP WHERE Field3 LIKE '%Search_Criteria%' AND Field6 >= #1/2/09# AND Field6 <= #1/30/09#  GROUP BY Field3, Field10
    Code2. I get error message SELECT Field3, Field10, SUM(Field16) as SumofField16 FROM CustomerHistory_CP WHERE Field3 LIKE '%Search_Criteria%' AND Field6 >= #Date1# AND Field6 <= #Date2#  GROUP BY Field3, Field10

  • SQL column as select statement to be referenced into a group by

    Is there a notation or solution to be able to reference a column that is a inline select statement within a group by as detailed below? The group by will not accept the alias. I also tried to make the SQL a MAX to remove the need for the group by reference and this returned invalid expression.
    SELECT DISTINCT hdr.BUSINESS_UNIT,
    hdr.SESSN_ID,
    hdr.STREAM_ROOT_ID,
    hdr.SESSN_STS_CD,
    hdr.SESSN_CRE_DTTM,
    CASE
    WHEN C.OPRID <> ' ' THEN C.OPRID
    ELSE S.OPERATOR
    END OPRID,
    strm.QS_APP_CONTEXT,
    RECV.QTY_SH_RECVD Quantity_Received,
    CASE
    WHEN hdr.BUSINESS_UNIT = 'MFG01' THEN MAX(G.MFDS_SGRP_SIZE)
    ELSE MAX(S.SESSN_SGRP_SIZE)
    END Quantity_Inspected,
    MAX(S.QS_VALUEREADING_1) Defect_Count,
    CASE
    WHEN MAX(S.QS_VALUEREADING_1) = 0 THEN ' '
    ELSE MAX(G.MFDS_NAME)
    END Characteristic,
    MAX(CMNT.QS_COMMENT2) COMMENTS,
    strm.INV_ITEM_ID,
    itm.DESCR,
    strm.WORK_CENTER_CODE,
    strm.VENDOR_ID,
    *(SELECT V.NAME1 FROM PS_VENDOR V WHERE strm.VENDOR_ID = V.VENDOR_ID AND V.SETID = (SELECT SETID FROM PS_SET_CNTRL_REC*
    WHERE  RECNAME = 'VENDOR'
    AND SETCNTRLVALUE = strm.BUSINESS_UNIT)) VENDOR_NAME,
    strm.PRDN_AREA_CODE,
    strm.COMPL_OP_SEQ,
    strm.PRODUCTION_TYPE,
    C.RECEIVER_ID,
    C.RECV_LN_NBR,
    RECV.PO_ID,
    RECV.LINE_NBR,
    RECV.SCHED_NBR,
    C.PRODUCTION_ID,
    C.SERIAL_ID,
    C.INV_LOT_ID
    FROM PS_QS_SESSN_HDR8 hdr
    LEFT OUTER JOIN PS_QS_SESSN_TRACE8 C
    ON hdr.BUSINESS_UNIT = C.BUSINESS_UNIT
    AND hdr.SESSN_ID = C.SESSN_ID
    LEFT OUTER JOIN PS_RECV_INSPDTL_VW RECV
    ON C.BUSINESS_UNIT = RECV.BUSINESS_UNIT
    AND C.RECEIVER_ID = RECV.RECEIVER_ID
    AND C.RECV_LN_NBR = RECV.RECV_LN_NBR
    LEFT OUTER JOIN PS_QS_STREAM_ROOT strm
    ON hdr.STREAM_ROOT_ID = strm.STREAM_ROOT_ID
    AND hdr.BUSINESS_UNIT = strm.BUSINESS_UNIT
    LEFT OUTER JOIN PS_QS_STREAM8_VW G
    ON strm.STREAM_ROOT_ID = G.STREAM_ROOT_ID
    AND strm.BUSINESS_UNIT = G.BUSINESS_UNIT
    LEFT OUTER JOIN PS_QS_SUBGROUP S
    ON hdr.BUSINESS_UNIT = S.BUSINESS_UNIT
    AND hdr.SESSN_ID = S.SESSN_ID
    AND S.STREAM_ID = G.STREAM_ID
    LEFT OUTER JOIN PS_QS_SESSN_COMM8 CMNT
    ON S.BUSINESS_UNIT = CMNT.BUSINESS_UNIT
    AND S.SESSN_ID = CMNT.SESSN_ID
    AND S.STREAM_ID = CMNT.STREAM_ID
    AND C.SAMPLE = CMNT.SAMPLE
    LEFT OUTER JOIN PS_MASTER_ITEM_TBL itm
    ON itm.INV_ITEM_ID = strm.INV_ITEM_ID
    LEFT OUTER JOIN PS_SET_CNTRL_REC cntrl
    ON itm.SETID = cntrl.SETID
    AND cntrl.RECNAME = 'MASTER_ITEM_TBL'
    AND cntrl.SETCNTRLVALUE = strm.BUSINESS_UNIT
    WHERE S.QS_VALUEREADING_1 = (SELECT MAX(S2.QS_VALUEREADING_1)
    FROM PS_QS_SUBGROUP S2
    WHERE S2.BUSINESS_UNIT = S.BUSINESS_UNIT
    AND S2.SESSN_ID = S.SESSN_ID
    AND S2.STREAM_ID = S.STREAM_ID)
    GROUP BY hdr.BUSINESS_UNIT,
    hdr.SESSN_ID,
    hdr.STREAM_ROOT_ID,
    hdr.SESSN_STS_CD,
    hdr.SESSN_CRE_DTTM,
    C.OPRID,
    S.OPERATOR,
    strm.QS_APP_CONTEXT,
    RECV.QTY_SH_RECVD,
    strm.INV_ITEM_ID,
    itm.DESCR,
    strm.WORK_CENTER_CODE,
    strm.VENDOR_ID,
    VENDOR_NAME,
    strm.PRDN_AREA_CODE,
    strm.COMPL_OP_SEQ,
    strm.PRODUCTION_TYPE,
    C.RECEIVER_ID,
    C.RECV_LN_NBR,
    RECV.PO_ID,
    RECV.LINE_NBR,
    RECV.SCHED_NBR,
    C.PRODUCTION_ID,
    C.SERIAL_ID,
    C.INV_LOT_ID

    Hi,
    Assign the alias in a sub-query. Then you'll be able to use it wherever you want to, and how many times you want to, in a super-query.
    For example:
    WITH     got_vendor     AS
         SELECT     hdr.business_unit
                  SELECT  v.name1
                  FROM    ps_vendor     v
                  WHERE   strm.vendor_id     = v.vendor_id
                  AND     v.setid          = (
                                                SELECT  setid
                                        FROM    ps_set_cntrl_rec
                                        WHERE   recname          = 'VENDOR'
                                        AND     setcntrlvalue      = strm.business_unit
              )           AS vendor_name
         FROM      ps_qs_sessn_hdr8     hdr
    SELECT       business_unit          -- NOTE: no hdr.; all columns are from got_vendor now
    ,       vendor
    FROM       got_vendor
    GROUP BY  business_unit
    ,       vendor
    ;When you define an alias (such as vendor) in a query, you can use that alias in the ORDER BY clause of that same query, but that's the only place in that same query where you can use it. If you want to use the alias anywhere else (e.g., in the GROUP BY clause, as in your example, the WHERE clause, or elsewhere in the SELECT clause), then you probably want to compute it in a sub-query, as shown above.
    There's probably a better way to compute vendor, but that's a separate problem.
    Edited by: Frank Kulash on Jan 3, 2012 10:37 AM
    Added example

  • Select Statement inside the insert statement

    I need to insert the values into nav_pending by selecting the values from nav table
    when i write this code its giving missing expression error
    Can i know what is the problem??
    can i use select inside insert in oracle????
    INSERT INTO NAV_PENDING (ACCOUNT_NUM,PERIOD_DTE)
    VALUES
    SELECT ACCOUNT_NUM,PERIOD_DTE
    FROM NAV where ACCOUNT_NUM=1;
    Thanks in advance

    Leave the values keyword
    INSERT INTO NAV_PENDING (ACCOUNT_NUM,PERIOD_DTE)
    SELECT ACCOUNT_NUM,PERIOD_DTE
    FROM NAV where ACCOUNT_NUM=1;

  • Select Statement - from Decimal Fields into Char

    Hi
    I would like to run a SELECT from table T007A into an internal table which is of type TXW_TAXCOD.
    T007A has a decimal field in it ( TOLERANCE ) which is of data type DEC, length of 3 and 1 decimal place.
    This is the code in the standard program --
    select * from t007a
             into corresponding fields of table t_txw_taxcod up to 20 rows.
    I have to make the TOLERANCE field value in T007A land up in a character field in the structure, I have declared the TOLERANCE field in structure TXW_TAXCOD as a character field of type 5 (infact tried CHAR4 and CHAR8 etc etc) but I face a runtime error
    I cannot change the code in standard program, can you please tell me what other data type can I use to make this select work

    If LTXW0F02 is your program and form extract_txw_taxcod
    then
      select * from t007a
               into corresponding fields of table t_txw_taxcod.
      sort t_txw_taxcod.
      loop at t_txw_taxcod.
        select single * from t007s
                        where spras = sy-langu
                          and kalsm = t_txw_taxcod-kalsm
                          and mwskz = t_txw_taxcod-mwskz.
        if sy-subrc = 0.
          move-corresponding t007s to t_txw_taxcod.
        endif.
        call function 'TXW_SEGMENT_RECORD_EXPORT'
          exporting
            data_record = t_txw_taxcod.
      endloop.
    Within the function module TXW_SEGMENY_RECORD_EXPORT have implicit enhancements try to use then and make one more select to table t007s using key KALSM and fill the char field TOLERENCE
    select tolerence from t007a into v_tolerence
              where kalsm = t_txw_taxcod-kalsm.
       write: v_tolerence to t_txw-taxcod-tolerence.

  • Search function with multiple keywords

    hi everybody,
    im a beginner apex developer, im trying to develope a search function on my page.
    i have created an item "where" where u can give the adress u r looking for.
    my problem is that the search works only when i insert one word into the item e.g. street or city.
    when i try to look for street and city at the same time it doesnt work.
    in my database i have columns for city, street, zipcode... etc
    and im using Application Express 3.1.2.00.02
    this is my search code
    select country, city,zipcode, street
    from mytable
    where
    +( lower(city) like '%' || lower(trim(:P1_WHERE)) || '%'+
    OR lower(zipcode) like '%' || lower(trim(:P1_WHERE)) || '%'
    OR lower(street) like '%' || lower(trim(:P1_WHERE)) ||  '%'
    OR lower(country) like '%' || lower(trim(:P1_WHERE)) || '%')
    i have tried to solve the problem by adding combination after OR:
    lower(concat(trim(city) like '%' ||  lower(replace(:P1_WHERE,' ','')) || '%'||,trim(zipcode) like '%' ||  lower(replace(:P1_WHERE,' ','')) || '%'||))
    but this is not working. and i will have too many combinations.
    any help is highly appreciated!
    Edited by: user12976392 on 14-Jun-2010 07:08

    Oracle don't provide any SPLIT() function, I don't know why.
    But you can use INSTR() and SUBSTR() functions instead.
    There are some split functions on the web, like this one for example (don't really split but get tokens) : http://glosoli.blogspot.com/2006/07/oracle-plsql-function-to-split-strings.html.
    Then you can loop to get all the tokens (here I used the ' ' separator) :
    DECLARE
          oneToken VARCHAR2(100) ;
          cpt INTEGER := 1;
    BEGIN
          LOOP
          oneToken := get_token(html_GetElement(P1_WHERE).value, cpt , ' ') ;
          EXIT WHEN oneToken IS NULL ;
          cpt := cpt + 1 ;
        END LOOP ;
    END ;Using this you can build your query as string, then open a cursor to run it, using :
    open my_cursor for my_string;I really don't know if it's the best way to do this, it's just an idea.

  • Select statement inside a select statement is not working as thought it would.

    Hi all,
    I have problem in the following programming code:
    SELECT ACCT_FD_NO,ACCT_CUST_CODE, STAUS, FDR_STAUS, AMOUNT,INT_RATE ,MATURITY_DATE,(AMOUNT*(INT_RATE/100)/365)no_of_days,
    (AMOUNT*(INT_RATE/100)/365)*((TO_DATE(:X_PRM_ST_DT)-TO_DATE(:X_PRM_YR_END_DT)))tot_int FROM KEC_FDACCT_MSTR
    WHERE acct_type NOT  IN(1,2,3,4,5,6,13,14,15,16,17,18,25,26,27,28,29,30) AND FDR_STAUS='R' AND STAUS='E'
    AND  ACCT_OPN_DT>:X_PRM_YR_END_DT
    AND ACCT_FD_NO IN(SELECT OLD_FDR_NO FROM KEC_FDACCT_MSTR WHERE FDR_STAUS='R' AND acct_type NOT  IN(1,2,3,4,5,6,13,14,15,16,17,18,25,26,27,28,29,30)
    AND  ACCT_OPN_DT>:X_PRM_YR_END_DT);
    The following is the Table KEC_FDACCT_MSTR with the columns shown with data.
    ACCT_FD_NO
    ACCT_CUST_CODE
    ACCT_TYPE
    ACCT_OPN_DT
    FDR_STAUS
    STAUS
    AMOUNT
    INT_RATE
    GROUP_TYPE
    OLD_FDR_NO
    MATURITY_DATE
    250289
    3
    25
    07/12/2012
    R
    E
    140,000.00
    11.50
    12MNS
    60002
    06/12/2013
    250290
    3
    25
    07/12/2012
    R
    E
    140,000.00
    11.50
    12MNS
    60001
    06/12/2013
    270968
    4
    27
    14/07/2013
    M
    E
    450,000.00
    12.50
    36MNS
    30227
    13/07/2016
    330516
    9
    33
    08/12/2012
    R
    E
    50,000.00
    12.50
    36MNS
    90001
    07/12/2015
    320217
    11
    32
    08/12/2012
    R
    E
    50,000.00
    12.00
    24MNS
    90002
    07/12/2014
    330513
    12
    33
    08/12/2012
    R
    E
    100,000.00
    12.50
    36MNS
    90003
    07/12/2015
    360017
    13
    36
    01/12/2012
    R
    E
    50,000.00
    12.50
    36MSH
    120002
    30/11/2015
    360018
    15
    36
    05/12/2012
    R
    E
    100,000.00
    12.50
    36MSH
    120004
    04/12/2015
    270743
    22
    27
    09/12/2012
    R
    E
    50,000.00
    12.50
    36MNS
    30004
    08/12/2015
    270744
    22
    27
    09/01/2013
    R
    E
    200,000.00
    12.50
    36MNS
    30112
    08/01/2016
    270316
    25
    27
    07/12/2012
    R
    E
    70,000.00
    12.50
    36MNS
    30007
    06/12/2015
    360019
    29
    36
    05/12/2012
    R
    E
    100,000.00
    12.50

    This is the table on which i'm writing the code:
    ACCT_FD_NO
    ACCT_CUST_CODE
    ACCT_OPN_DT
    FDR_STAUS
    STAUS
    AMOUNT
    INT_RATE
    OLD_FDR_NO
    SAP_CODE
    MATURITY_DATE
    350001
    743
    17-Nov-10
    M
    D
    200000
    12.00
    323055
    16-Nov-12
    350002
    734
    18-Nov-10
    R
    D
    300000
    12.00
    100018
    323055
    17-Nov-12
    350003
    736
    19-Nov-10
    R
    D
    150000
    12.00
    100015
    323055
    18-Nov-12
    350004
    737
    20-Nov-10
    R
    D
    500000
    12.00
    100016
    323055
    19-Nov-12
    350005
    735
    19-Nov-10
    M
    D
    150000
    12.00
    323055
    18-Nov-12
    350006
    738
    20-Nov-10
    M
    D
    1500000
    12.00
    323055
    19-Nov-12
    350007
    734
    19-Nov-10
    R
    D
    200000
    12.00
    100013
    323055
    18-Nov-12
    350008
    83
    30-Nov-10
    M
    D
    50000
    12.00
    323055
    29-Nov-12
    350009
    136
    12-Dec-10
    R
    D
    200000
    12.00
    100006
    323055
    11-Dec-12
    350010
    716
    12-Nov-11
    M
    D
    200000
    12.00
    323055
    11-Nov-13
    350011
    746
    16-Nov-12
    R
    E
    200000
    12.00
    120054
    323055
    15-Nov-14
    350012
    731
    13-Nov-12
    R
    E
    400000
    12.00
    290001
    323055
    12-Nov-14
    350013
    3,906
    10-Sep-13
    N
    E
    100000
    12.00
    323055
    9-Sep-15
    350014
    3,907
    18-Sep-13
    N
    E
    50000
    12.00
    323055
    17-Sep-15
    360001
    811
    4-Oct-10
    M
    D
    100000
    12.50
    323056
    3-Oct-13
    360002
    535
    7-Oct-10
    P
    D
    10000000
    12.50
    323056
    6-Oct-13
    360003
    527
    7-Oct-10
    M
    D
    4000000
    12.50
    323056
    6-Oct-13
    360004
    54
    19-Oct-10
    M
    D

  • Select statement for export with timestamp

    Hi!
    Im planning on doing an export of a DB based on its date. But I only want to export tables that have a timestap and are newer then >31/12 2006 and all the other tables (that dont have a timestamp). But I lack the experience of PL/SQL.
    Can anyone help me in the rigth direction? Below are a small start
    BEGIN
    IF timestamp.EXISTS THEN
    select * from Regards
    PL/SQL newbie

    If you want to export in order to be able to import in a Oracle database:
    if your Oracle version is >= 10, then you should try to use Data Pump export (expdp) with QUERY parameter.
    if your Oracle version is <= 9, then you should try to use export (exp) with QUERY parameter.
    Message was edited by:
    Pierre Forstmann

Maybe you are looking for

  • No internet access via ethernet port

    Hi, have been using my emac via ethernet cable to router, for many months with NO problem accessing internet and others cabled to same router also having no problem and I have used my Pwr Mac wtih no problem and have never had to make any specific se

  • Non Cumulative and Cumulative Key Figure

    Hi all:    Can anyone clarify difference between Non cumulative KF and Cumulative KF.What is the use of these two and when we go for this.? Please send me if any docs [email protected] Rgds MSK Note: Points to be reward.

  • Oracle Services & Management Server

    (1) I had installed Oracle 8.1.7 on Window2000 Advance Server. Generally in NT Server, upon restarting server all services come up automatically, but my Oracle Services shows started and when I try to connect through SQL Plus it gives me error "0RA-2

  • When I tried to install InDesign CC, I got the following Installation Failed message: ERROR: DF024:

    Here's the full error message(s).  Please explain in simple terms, I'm not an expert PC person. Thanks! ----------- Payload: AdobeColorCommonSetCMYK CC 5.0.0.0 {C4196275-B11A-40A1-8727-3C145C8F7D95} ----------- ERROR: DF012: Unable to find file(Seq 1

  • New Overlay Creator tools (Pullout Tabs)

    Hello DPS community, My question is in regards to the new tools available in DPS. I have created my folio for my senior degree project over the last few months. I have a 3rd generation iPad that I am previewing my project with the new version of Cont