Change function to work for date data type

I have found the below function form the AstTom page. This function works perfectly when i pass varchar datatype and I am wondering what do i need to change here of course the datatype inoder
for this function to accept date value. example I want to pass (05/21/2010, 04/23/2010) as a date data type and
--create your type
create or replace type varcharTableType as table   of varchar2 (255); 
CREATE OR REPLACE FUNCTION tplcp.in_varchar (p_string IN VARCHAR2)
   RETURN varchartabletype
AS
   l_string   LONG             DEFAULT p_string || ',';
   l_data     varchartabletype := varchartabletype ();
   n          NUMBER;
BEGIN
   LOOP
      EXIT WHEN l_string IS NULL;
      n := INSTR (l_string, ',');
      l_data.EXTEND;
      l_data (l_data.COUNT) := LTRIM (RTRIM (SUBSTR (l_string, 1, n - 1)));
      l_string := SUBSTR (l_string, n + 1);
   END LOOP;
   RETURN l_data;
END in_varchar;
CREATE OR REPLACE PROCEDURE planholderslist (
   p_letting_date   IN       VARCHAR2,
   p_results        OUT      sys_refcursor
AS
BEGIN
   OPEN p_results FOR
      SELECT DISTINCT DECODE (TRIM (MIN (j.route)),
                              NULL, 'N/A',
                              TRIM (MIN (j.route))
                             ) routenumber,
                      l.lcontid contractid, (q.cdescr) jobdescription,
                      INITCAP (q.clocat1 || q.clocat2) LOCATION,
                      SUBSTR (q.cprojnum, 1, 10) projectnumber,
                         SUBSTR (l.letting, 3, 2)
                      || '-'
                      || SUBSTR (l.letting, 5, 2)
                      || '-'
                      || SUBSTR (l.letting, 1, 2) lettingdate
                 FROM vendor v,
                      vendaddr r,
                      letprop l,
                      planhold p,
                      proposal q,
                      project j,
                      propproj k,
                      bidlet bd
                WHERE v.vendor = r.vendor
                  AND k.contid = q.contid
                  AND k.pcn = j.pcn
                  AND l.lcontid = k.contid
                  AND p.vendor = v.vendor
                  AND l.letting = p.letting
                  AND (TO_CHAR (bd.datelet, 'MM/DD/YY') IN (
                                      SELECT COLUMN_VALUE
                                        FROM TABLE (in_varchar (p_letting_date)
                  AND l.CALL = p.CALL
                  AND r.addrnum = p.billto
                  AND bd.letting = l.letting
             GROUP BY q.cdescr,
                      q.clocat1,
                      q.clocat2,
                      bd.letting,
                      l.letting,
                      l.lcontid,
                      q.cprojnum
             ORDER BY lettingdate;
END planholderslist;
/

three or even four dates passed to the parameter.4 date parameters are still easy to code for. Use an IN clause.
Just do something like this:
SQL> select * from t;
D
05-JAN-2010 00:00:00
15-MAR-2010 00:00:00
09-SEP-2010 00:00:00
07-DEC-2010 00:00:00
SQL> create or replace
  2  procedure find_date (rc out sys_refcursor
  3                      ,p1 in date
  4                      ,p2 in date default null
  5                      ,p3 in date default null
  6                      ,p4 in date default null
  7                      ) as
  8  begin
  9    open rc for
10       select d
11       from   t
12       where  d in (p1,p2,p3,p4);   -----<<< notice this line
13  end;
14  /
SQL> var results refcursor
SQL> exec find_date(:results, to_date('05-JAN-2010'));
PL/SQL procedure successfully completed.
SQL> print results
D
05-JAN-2010 00:00:00
SQL> exec find_date(:results, to_date('05-JAN-2010'),to_date('09-SEP-2010'));
PL/SQL procedure successfully completed.
SQL> print results
D
05-JAN-2010 00:00:00
09-SEP-2010 00:00:00
SQL> exec find_date(:results, to_date('05-JAN-2010'),to_date('09-SEP-2010'), sysdate);
PL/SQL procedure successfully completed.
SQL> print results
D
05-JAN-2010 00:00:00
09-SEP-2010 00:00:00
SQL> exec find_date(:results, to_date('05-JAN-2010'),to_date('09-SEP-2010'), to_date('15-MAR-2010'), to_date('07-DEC-2010'));
PL/SQL procedure successfully completed.
SQL> print results
D
05-JAN-2010 00:00:00
15-MAR-2010 00:00:00
09-SEP-2010 00:00:00
07-DEC-2010 00:00:00

Similar Messages

  • Clob is not working for bulk data files in PL/SQL XML program

    Hi Odie,
    we took your help to fix the our issue before
    "https://forums.oracle.com/forums/thread.jspa?threadID=2238458&tstart=105"
    working fine for : program is working for smaller size data.
    Issue : now we have problem with the largr size data .
    getting the below error:
    Arguments
    P_dir_name='/tmp'
    P_file_name='CCBGO.COLO_CNG.RESPONSES.20120802.00054131826'
    Environment will now switch to UTF-8 code-set.
    Parts of this log file may not display correctly
    as a result. This is an expected behavior.
    XML_REPORTS_XENVIRONMENT is :
    /apps/applmgr/product/OFDEV/ofdevora/806/guicommon6/tk60/admin/Tk2Motif_UTF8.rgb
    XENVIRONMENT is set to /apps/applmgr/product/OFDEV/ofdevora/806/guicommon6/tk60/admin/Tk2Motif_UTF8.rgb
    Current NLS_LANG and NLS_NUMERIC_CHARACTERS Environment Variables are :
    American_America.UTF8
    stat_low = 8B
    stat_high = 0
    emsg:was terminated by signal 11
    Appreciated for your earlier support.
    Kindly suggest .
    Many Thanks,
    Ramesh.

    Thanks ALex,
    your are true it is concurrent program error ,
    but it is working for small amount of data and generating the output and it is not working for larger data.
    i have placed the code which i have used kindly suggest where i am going wrong.
    i am calling the .rdf through the concurrent program, i've used the below query in RDF
    select
    BATCHHEADER
    ,BATCHTRAILER
    ,RqUID
    ,Severity
    ,PmtRefId
    ,StatusDesc
    ,ErrorDesc
    ,AsOfDate
    ,AsOfTime
    ,RqUID1
    ,SPRefId
    from table(CL_CXFRFXFH_PKG.rcacknowledgments(:P_dir_name,:P_file_name));
    kindly find the below code for the package CL_CXFRFXFH_PKG.
    ==========================
    CREATE OR REPLACE package body APPS.CL_CXFRFXFH_PKG is
    function rcacknowledgments (p_directory in varchar2, p_filename in varchar2)
    return TRecordTable pipelined
    is
    nb_rec number := 1;
    tmp_xml clob;
    tmp_file clob;
    rec TRecord;
    begin
    dbms_lob.createtemporary(tmp_file, true);
    tmp_file := dbms_xslprocessor.read2clob(p_directory, p_filename);
    rec.BATCHHEADER := regexp_replace(tmp_file, '.*<BATCHHEADER>(.*)</BATCHHEADER>.*', '\1', 1, 1, 'n');
    rec.BATCHTRAILER := regexp_replace(tmp_file, '.*<BATCHTRAILER>(.*)</BATCHTRAILER>.*', '\1', 1, 1, 'n');
    loop
    tmp_xml := regexp_substr(tmp_file, '<\?xml[^?]+\?>\s*<([^>]+)>.*?</\1>', 1, nb_rec, 'n');
    exit when length(tmp_xml) = 0;
    --dbms_output.put_line(tmp_rec);
    nb_rec := nb_rec + 1;
    select RqUID, Severity, PmtRefId, StatusDesc, ErrorDesc, AsOfDate, AsOfTime, RqUID1, SPRefId
    into rec.RqUID
    , rec.Severity
    , rec.PmtRefId
    , rec.StatusDesc
    , rec.ErrorDesc
    , rec.AsOfDate
    , rec.AsOfTime
    , rec.RqUID1
    , rec.SPRefId
    from xmltable(
    '/CMA/BankSvcRq' passing xmltype(tmp_xml)
    columns RqUID varchar2(3000) path 'RqUID'
    , Severity varchar2(3000) path 'XferAddRs/Status/Severity'
    , PmtRefId varchar2(3000) path 'XferAddRs/Status/PmtRefId'
    , StatusDesc varchar2(3000) path 'XferAddRs/Status/StatusDesc'
    , ErrorDesc varchar2(3000) path 'XferAddRs/Status/ErrorDesc'
    , AsOfDate varchar2(3000) path 'XferAddRs/Status/AsOfDate'
    , AsOfTime varchar2(3000) path 'XferAddRs/Status/AsOfTime'
    , RqUID1 varchar2(3000) path 'XferAddRs/RqUID'
    , SPRefId varchar2(3000) path 'XferAddRs/SPRefId'
    pipe row ( rec );
    end loop;
    dbms_lob.freetemporary(tmp_file);
    return;
    end;
    end;
    ============================================
    Many Thanks,
    Ramesh.

  • REPEAT DELTA WILL WORK FOR MASTER DATA DELTA LOADS

    Hi Guru's,
    REPEAT DELTA WILL WORK FOR MASTER DATA DELTA LOADS?
    AS I AM NEW TO SAP-BI CAN ANY ONE GIVE THE DETAIL EXPLANATION ON IT.
    IT WILL BE GREAT AND HELPFULL.
    Thanks and Regards,
    CM

    Hi CM,
    yes you can perform the repeat delta even for the master data if the datasource which was supplying the data was delta capable.
    You can do the repeat delta only in case if your previous request was erroneous and dont forget to make the request red in the status,so that system will treat like you are requesting the failed request once again where in case you will miss the previous request, i,e erroneous request if you dont make the request red.
    when you make the request red manually in the status,the pointer will move to the previous request once again in the delta queue and there will be no chance of missing the delta records.
    This process was same for both transaction as well as master data.
    Regards,
    Sunil...

  • Receiver determination doesn't work for same IDoc type but in differentSWCV

    hi guys,
    we have an emergency now. Receiver determination doesn't work for same IDoc type but in different SWCV.Please check below for detail.
    1. The process flow is : R/3 IDoc -> XI -> Third party system
    2. In previous release R13, IDoc ORDERS05 was imported and used in XI and software component version is R13. And receiver determination was created.
    3. Now, in new release R17, IDoc ORDERS05 was imported from R/3 to XI again and software component version is R17. And in R17, the receiver determination created in R13 was used for both old interface(R13) and new interface in R17.
    Then we encountered the problem, both interfaces doesn't work now, even we deleted the receiver condition(In R13, IDoc ORDERS05 was sent to system A, and in R17 IDoc ORDERS05 was sent to system B, RCVPRN was used as an condition).
    Does anyone encounter this problem? really need and appreciate your help.
    -Eddie

    information from monitor:
    Status     Sender               Service Sender Namespace                         Sender Interface
    reschedul  XXXCLNT100     urn:sap-com:document:sap:idoc:messages   ORDRSP.ORDERS05
    columns for "Receiver Service","Receiver Namespace", "Receiver Interface" are blank
    And then double click records in monitor, go into detail information...
    Normally there's lots of setps existed, such as
    Inbound Message ( CENTRAL )
    Receiver Identification
    Interface Determination
    Receiver Grouping
    Message Branch According to Receiver List
    Technical Routing
    Call Adapter
    But now there's only one setp -
    "Inbound Message ( CENTRAL )" existed, no any another setp..., and payload in inbound message looks good.
    And in SMQ2, I checked the queue information, found there's an error - "An exception occurred that was not caught." No any other detail information for this error.

  • Calculation formula userexit not working for multiple condition types

    Hi,
    we have a problem in the CRM ISA-B2B scenario where the custom user exit is only working for single condition type.
    but we need it for multiple condition types .
    the value of the subtotal is not being retrieved for multiple conditions. at a time only one condition value is being retrieved and shown in the webshop - shopping basket.
    for ex:
    we have scenario 1 where Y001 -Freight condition type is applicable for one customer.and Y002 is applicable for another customer.
    when we are trying to show the subtotal condition value in the webshop by using a single custom user exit in the pricing procedure it is only working for either of the above 2 customers depending on the VMC cache status.
    is there any problem if use the single user exit for both condition types?
    and if it needs to be differentiated how exactly we can do that with the same logic in the java class.
    Thanks in advance,
    PSR.

    Hi Arshi,
    below is the code:
    public class ZValFormula_ZZWI1 extends ValueFormulaAdapter {
         private static String zzwi = "ZZWI1";
         private static char  zzwiC = '@';
         private static UserexitLogger userexitlogger = new UserexitLogger(
         ZValFormula_ZZWI1.class);
         public BigDecimal overwriteConditionValue(IPricingItemUserExit item,
                   IPricingConditionUserExit condition) {
              ICurrencyValue val = condition.getConditionValue();
              userexitlogger.writeLogDebug( "value saved for " + zzwi + " (" + zzwiC + ") = "
                        + val.getValueAsString());
              item.setSubtotal( zzwiC, val.getValue());
              return val.getValue();
    hope this would give more idea to look at the problem.
    Thanks,
    PSR

  • Does anyone know if the scanner function will work for an Epson Workforce 840 aio printer using Mountain Lion 10.8.2?

    Does anyone know if the scanner function will work for an Epson Workforce 840 aio printer using Mountain Lion 10.8.2?  How is the compatiblity generally speaking?

    Hi,
    The Epson Workforce 840 do support scanning on Mountain Lion via Apple Image Capture.
    You may find the steps to configure the scanner by following the ICA Scanner Driver section below:
    http://www.epson.com/cgi-bin/Store/support/supDetail.jsp?oid=168363&infoType=Dow nloads&platform=OSF_M_X8
    Regards,
    Shlomi

  • FUNCTION MODULE CREATION FOR GENERIC DATA SOURCE

    Hi BI gurus,
    I am creating function module for generic datasource. For that I followed below mentioned steps
    Steps
    1.     Created s structure with the fields that needed.
    2. Created FM by copying the standard Function module
    " RSAX_BIW_GET_DATA_SIMPLE " and Give a New name starting With
    Y or Z .
    3. IN SE37 ->Your Function module name -> Change, In table tab given structure
    name by deleting the associated type given in “E_T_DATA “.
    And inserted the required code given below
          PROGRAM 'ZHU_BALANCE'.
    *& Report  ZHU_BALANCE
    TABLES: VEKP, VEPO.
    DATA: BEGIN OF T_DISPLAY,
          DATE   LIKE SY-DATUM,
          EXIDV  LIKE VEKP-EXIDV,
          LGORT  LIKE VEPO-LGORT,
          WERKS  LIKE VEKP-WERKS,
          END OF T_DISPLAY.
    DATA: ITAB_DISPLAY LIKE TABLE OF T_DISPLAY.
    DATA: WA_ITAB_DISPLAY LIKE LINE OF ITAB_DISPLAY.
    SELECT VEKPEXIDV VEPOLGORT VEPO~WERKS
           INTO CORRESPONDING FIELDS OF TABLE ITAB_DISPLAY
           FROM VEKP AS VEKP INNER JOIN VEPO AS VEPO
             ON  VEKPVENUM = VEPOVENUM
             AND VEKPWERKS = VEPOWERKS
           WHERE VEKP~VSTEL = SPACE
             AND VEKP~VEGR1 = '401'
             AND VEKP~VPOBJ = '12'
             AND VEKP~STATUS = '0020'
             AND VEPO~VEPOS = '000001'.
    LOOP AT ITAB_DISPLAY INTO WA_ITAB_DISPLAY.
    WA_ITAB_DISPLAY-DATE = SY-DATUM.
    MODIFY ITAB_DISPLAY FROM WA_ITAB_DISPLAY TRANSPORTING DATE.
    ENDLOOP.
    WRITE:/ 'DATE', 20 'EXIDV', 40 'LGORT', 60 'WERKS'.
    ULINE.
    LOOP AT ITAB_DISPLAY INTO WA_ITAB_DISPLAY.
    WRITE:/ WA_ITAB_DISPLAY-DATE, 20 WA_ITAB_DISPLAY-EXIDV , 40 WA_ITAB_DISPLAY-LGORT, 60 WA_ITAB_DISPLAY-WERKS.
    ENDLOOP.
    While checking the function module it’s populating the syntax error as
    THE TYPE “SRSC_S_IF_SIMPLE” IS UNKOWN. (Though this is commented in program)
    So pls suggest
    Regards,
    praful

    hi indira,
    thanx for ur reply we have created the funcion module successfuly it is also showing the output correct. But when we put that function module in the generic data source and try to extract data in RSA3 it shows the correct output of function module but with the msg ' 0 entries found in customer enhancement' and therfore zero records in the display list.
    is there any correction or steps to be followed in data extraction
    pls suggest
    regards,
    praful

  • Change pointers in CRM for Product Data Extraction using MDM_CLNT_EXTR

    Hi All,
    We want to extract Product data in Delta mode using MDM_CLNT_EXTR.
    I think change pointers are activated in CRM system in a different way. Please let me know steps to activate change pointers in CRM system for Product Data.
    Thanks in advance for your help.
    Regards,
    Shiv

    Hi,
       Please follow the below steps fro change pointers.
    1.      In the Implementation Guide (IMG, transaction SALE), choose Modeling and Implementing ® Master Data Distribution ®Replication of Modified Data ® Activate Change Pointers ‑ Generally.
    2.      Set the activation status Activate Change Pointers ‑ Generally, and save your entry (i.e BD61 Activate Change Pointers ).
    3.      Choose the activity Activate Change Pointers for Message Types like ORDERS.
    4.      Set the active indicator for the message type .
    5.      Save your entries.
    warm regards
    Mahesh.

  • Where used list doesn't work for global data

    Hi,
    When i try to do where used list on a constant in an include, it doesn't give the results for classes.
    The class contains the include in a method that uses the constant, and the where used list for that constant doesn't find the appearance of the constant in the class.
    I tried to look for oss note that solves the problem but i couldn't find any.

    I tried to update the navigation index but it still doesn't work. from my debuging i found out that it just doesn't look in classes, all classes. I mean even in the where used itself there is not an option for used in classes. I checked it and it's a generic problem of the where used list for global data.
    Edited by: Cohen Lior on Apr 14, 2010 6:52 PM

  • Change pointer report scheduling for current dat

    Hi Gurus
    I want to schedule change pointer report RBDMIDOC from current date .
    But i want that This report genrate idoc only for today's changes not for older days.
    Any way to set the Sy-date in Variant??
    or any other idea ..pls suggest.
    Thanks
    SA

    tk

  • Output Type ZNEU not working for PO document type ZNB

    Hi all,
    I have copied from standard the document type ZNB, and also the output type ZNEU, (from NB and NEU), I have made and checked all the setting on NACE (condition records, procedures, output types and sequence) everything is same as standard, I have also mantained in the "Fine-Tuned Control: Purchase Order" the indicators 1 and 2 (for new and change) for ZNEU, and mantained in MN05 the entry for ZNB Doc Type with VN media=1, date/Time=4  so for me these is the only setting needed but for some reason I am not getting the message automaticaly, but if I create manually the message while creating the PO then it works fine.
    For Doc type NB and Output type NEU the system gererates correcly the message so I don't know what could be happening here.
    The reason I created these copies (ZNB and ZNEU) it's because I have a different plant in a different company code which need to issue PO's and need a different number range and also different FORM (with the logo of the other plant/Company)
    Any ideas on how to correct this??
    Regards

    The problem was that in spanish, the function partner VN and CP are PR and PR so this was confusing and the records were crossing each other, thanks to every one

  • Want to change the cost element for a activity type (KP26)

    Hi,
    I want to change the Allocation cost element for an activity type in KP26. I have already changed the cost element in the activity master data in KL02. Now i want to change it in KP26. I am trying to delete the existing line item in KP26  to create the new line item with the new cost element, but system not allowing to delete the existing one. It throws the error message ""Allocations with XXXXXXX/XXXX (Cost center/Activity type)  exist ; deletion not possible". Can someone please help me to change the cost element?
    Regards
    Dev

    Hi Rao and Lalit,
    Thanx for you people for helping me. i havin gone doubt here. If i am deleting the existing line in KP26 and create new line with appropriage cost element will it be cause the existing datas? I don't want to go for another activity type, because our process is a complex process exist all over the world in more than 300 company codes. So i want to use the existing activity type but want to change the allocation cost element alone. Is there any possibility to change the cost element alone?
    Regards,
    Dev

  • PDF Documents with Functional Buttons - Works for IE and FireFox but not for Chrome and Safari

    To all,
    Good morning.  Our institution developed a PDF document with functional buttons for printing and e-mailing.  When the document is viewed via Internet Explorer and Firefox, the functional buttons work as expected.  However if the document is viewed via Chrome and Safari, the functional buttons do not work.  The workaround for those who are using Chrome and Safari, the PDF document needs to be saved to their local drive before the functional buttons work.
    Has anyone experienced this issue before?  If yes, what was your solution other than the workaround.
    Thanks.
    Babylon5

    Here's how to configure your browser to run Adobe Reader: http://helpx.adobe.com/acrobat/using/display-pdf-browser-acrobat-xi.html

  • Change of User Status for SDHF transaction type

    Hi,
    We have a requirement to change the user status of transaction of type "SDHF" creted using CRMD_ORDER.
    We are using FM " CRM_STATUS_CHANGE_EXTERN" for the above requirement, but stuck with the following error "Status REL is not allowed". On analysis of error, it is observed that the FM is not changing the user status to a status with higher status number than the present status.
    Eg: If the current status number(Code - PMAP) is 35 and the required status  number (Code - REL) is 40, then the FM is throwing the above error. we cannot change the status numbers, as this will lead to re-alignment of statuses which is not acceptable.
    kindly help with the solution for the above error or is there any FM or other method of achieving the same requirement.
    Points wil be awarded for the helpful amswers.
    Regards,
    Imran

    Hello,
    Since the status has no number it will appear under statuses W/O number bottom right in status overview window.
    These status will appear as additional text beside current user status. For example if user staus is BUG and status without number is DFL and sets when deletion flag is set and gets deleted when it is revoked than user status will appear as
    BUG DFL -
    Deletion flag set.
    BUG -
    When deletion flag revoked.
    You have to live with it. I don't think there is a way out for that.
    Thanks
    Saikishore Ganga.

  • Change of USER status for SDHF transaction type though CRMD_ORDER

    Hi,
    We have a requirement to change the user status of transaction of type "SDHF" creted using CRMD_ORDER.
    We are using FM " CRM_STATUS_CHANGE_EXTERN" for the above requirement, but stuck with the following error "Status REL is not allowed". On analysis of error, it is observed that the FM is not changing the user status to a status with higher status number than the present status.
    Eg: If the current status number(Code - PMAP) is 35 and the required status  number (Code - REL) is 40, then the FM is throwing the above error. we cannot change the status numbers, as this will lead to re-alignment of statuses which is not acceptable.
    kindly help with the solution for the above error or is there any FM or other method of achieving the same requirement.
    Points wil be awarded for the helpful amswers.
    Regards,
    Imran

    Hello,
    Since the status has no number it will appear under statuses W/O number bottom right in status overview window.
    These status will appear as additional text beside current user status. For example if user staus is BUG and status without number is DFL and sets when deletion flag is set and gets deleted when it is revoked than user status will appear as
    BUG DFL -
    Deletion flag set.
    BUG -
    When deletion flag revoked.
    You have to live with it. I don't think there is a way out for that.
    Thanks
    Saikishore Ganga.

Maybe you are looking for