Oracle CHR(n) Function

I need an Oracle CHR(n) Function to have a BOLD message.
Have someone any idea?

Raf Royal wrote:
I need an Oracle CHR(n) Function to have a BOLD message.Display device?
The display renders the output. So it depends on the display device what is required to enabled bold text. If the display device is a web browser, then it will be HTML and the bold text HTML tag needs to be used.
If it is for example an ANSI device (like a console running the sqlplus program), then ANSI escape codes need to be used to tell the ANSI device to enable bold (and disable it after the end of the text).
I posted a basic example in {message:id=9276344} a while back for how to underline text. For bold text on an ANSI device, your SQL statement needs to include the following CHR() calls:
SQL> select chr(27)||'[1;10m'||'This is a test'||chr(27)||'[1;00m' as COL1 from dual;
COL1
This is a testThe output will be rendered as:
This is a test
If you are sending e-mail, then you need to tell the mail reader what renderer to use - and create a Mime body with Mime type HTML in order to use HTML rendering (and thus HTML tags in your mail).

Similar Messages

  • Chr(10) function

    How can i add chr(10) function without changing the existing sql code in the bold mark .Can someone help me ? I ll be greateful.
    elect
    prtcrc.id,
    decode(accrualflag, 'N', '5 (Non-Agent)','Y','1 (Agent or Device)', 'O','2 (Trials Involving other Interventions)', 'E','3 (Epidemiologic or other Observational Studies)', 'C','4 (Companion, Ancillary or Correlative Studies)') Agent,
    '('|| prttype.id ||') ' ||UPPER(prttype.descrip) Description,
    UPPER(spn.spnnam) Sponsor,
    initcap(diseasetreatedstr) || prt Site,
    prt IRBNO, coopgroup, coopgroupnumber,
    initcap(LTRIM(SUBSTR(phyNAM, 1, INSTR(phyNAM, ',')))||SUBSTR(LTRIM(SUBSTR(phyNAM, INSTR(phyNAM, ',')+1))||'.', 1, 1)) phynam,
    programtype ProgramID,
    finalirbapprovaldate "IRB Approval Date",
    closuretopatientaccrual "Date Closed",
    decode(phase, 'N', 'N/A', phase) phase,
    decode (studytype, 'Ancillary', 'Ancillary or Companion', 'Companion', 'Ancillary or Companion', studytype) "Trial Type",
    UPPER(fullname) Title,
    anticipatedtotalaccrual,
    anticipatedaccrualatgu
    from
    prtcrc, phy, prttype,spn
    &whereclause
    order by
    programtype, phynam

    brother, the reusult of my sql like this
    site
    breast-female02-104
    breastfemalecomes from diseasetreated field
    and 02-104 comes from prt
    i want to show my result as below
    site
    breast-female
    02-104
    pls tell me how can i do this without changing the existing line. Because if i do
    initcap(diseasetreatedstr)||chr(10)||prt irbno
    then i cannot see anything in my oracle report 9i under the coloumn site.Report query does not generate any error but i am sure i making mistakes when i try to concat both diseasetreatedstr and prt. pls help me
    select
    prtcrc.id,
    decode(accrualflag, 'N', '5 (Non-Agent)','Y','1 (Agent or Device)', 'O','2 (Trials Involving other Interventions)', 'E','3 (Epidemiologic or other Observational Studies)', 'C','4 (Companion, Ancillary or Correlative Studies)') Agent,
    '('|| prttype.id ||') ' ||UPPER(prttype.descrip) Description,
    UPPER(spn.spnnam) Sponsor,
    initcap(diseasetreatedstr) || prt Site,
    prt IRBNO,
    coopgroup, coopgroupnumber,
    initcap(LTRIM(SUBSTR(phyNAM, 1, INSTR(phyNAM, ',')))||SUBSTR(LTRIM(SUBSTR(phyNAM, INSTR(phyNAM, ',')+1))||'.', 1, 1)) phynam,
    programtype ProgramID,
    finalirbapprovaldate "IRB Approval Date",
    closuretopatientaccrual "Date Closed",
    decode(phase, 'N', 'N/A', phase) phase,
    decode (studytype, 'Ancillary', 'Ancillary or Companion', 'Companion', 'Ancillary or Companion', studytype) "Trial Type",
    UPPER(fullname) Title,
    anticipatedtotalaccrual,
    anticipatedaccrualatgu
    from
    prtcrc, phy, prttype,spn
    &whereclause
    order by
    programtype, phynam

  • Duplicate Rows In Oracle Pipelined Table Functions

    Hi fellow oracle users,
    I am trying to create an Oracle piplined table function that contains duplicate records. Whenever I try to pipe the same record twice, the duplicate record does not show up in the resulting pipelined table.
    Here's a sample piece of SQL:
    /* Type declarations */
    TYPE MY_RECORD IS RECORD(
    MY_NUM INTEGER
    TYPE MY_TABLE IS TABLE OF MY_RECORD;
    /* Pipelined function declaration */
    FUNCTION MY_FUNCTION RETURN MY_TABLE PIPELINED IS
    V_RECORD MY_RECORD;
    BEGIN
    -- insert first record
    V_RECORD.MY_NUM = 1;
    PIPE ROW (V_RECORD);
    -- insert second duplicate record
    V_RECORD.MY_NUM = 1;
    PIPE ROW (V_RECORD);
    -- return piplined table
    RETURN;
    END;
    /* Statement to query pipelined function */
    SELECT * FROM TABLE( MY_FUNCTION ); -- for some reason this only returns one record instead of two
    I am trying to get the duplicate row to show up in the select statement. Any help would be greatly appreciated.

    Can you provide actual output from an SQL*Plus prompt trying this? I don't see the same behavior
    SQL> SELECT * FROM V$VERSION;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for 64-bit Windows: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    SQL> CREATE TYPE MY_RECORD IS OBJECT(MY_NUM INTEGER);
      2  /
    Type created.
    SQL> CREATE TYPE MY_TABLE IS TABLE OF MY_RECORD;
      2  /
    Type created.
    SQL> CREATE OR REPLACE FUNCTION MY_FUNCTION
      2  RETURN MY_TABLE
      3  PIPELINED
      4          AS
      5                  V_RECORD        MY_RECORD;
      6          BEGIN
      7                  V_RECORD.MY_NUM := 1;
      8                  PIPE ROW(V_RECORD);
      9
    10                  V_RECORD.MY_NUM := 1;
    11                  PIPE ROW(V_RECORD);
    12
    13                  RETURN;
    14          END;
    15  /
    Function created.
    SQL> SELECT * FROM TABLE(MY_FUNCTION);
                  MY_NUM
                       1
                       1

  • Oracle 8i stored functions

    Can one use collections as parameters to an Oracle 8i stored function and can it return a collection? Does anyone have examples?

    Can one use collections as parameters to an Oracle 8i stored function and can it return a collection? Does anyone have examples?

  • Grouping error in Oracle's analytic function  PERCENTILE_CONT()

    Hi,
    I have a question regarding the usage of Oracle's analytic function PERCENTILE_CONT(). The underlying time data in the table is of hourly granularity and I want to fetch average, peak values for the day along with 80th percentile for that day. For the sake of clarification I am only posting relevant portion of the query.
    Any idea how to rewrite the query and achieve the same objective?
    SELECT   TRUNC (sdd.ts) AS ts,
             max(sdd.maxvalue) AS max_value, avg(sdd.avgvalue) AS avg_value,
             PERCENTILE_CONT(0.80) WITHIN GROUP (ORDER BY  sdd.avgvalue ASC) OVER (PARTITION BY pm.sysid,trunc(sdd.ts)) as Percentile_Cont_AVG
    FROM     XYZ
    WHERE
              XYZ
    GROUP BY  TRUNC (sdd.ts)  
    ORDER BY  TRUNC (sdd.ts)
    Oracle Error:
    ERROR at line 5:
    ORA-00979: not a GROUP BY expression

    You probably mixed up the aggregate and analytical versin of PERCENTILE_CONT.
    The below should work, but i dont know if it produces the desireed results.
    SELECT   TRUNC (sdd.ts) AS ts,
             max(sdd.maxvalue) AS max_value, avg(sdd.avgvalue) AS avg_value,
             PERCENTILE_CONT(0.80) WITHIN GROUP (ORDER BY  sdd.avgvalue ASC)  as Percentile_Cont_AVG
    FROM     XYZ
    sorry, what is this where clause for??
    WHERE
              XYZ
    GROUP BY  TRUNC (sdd.ts)  
    ORDER BY  TRUNC (sdd.ts) Edited by: chris227 on 26.03.2013 05:45

  • How to implement the Oracle Group by function in Crystal reports?

    Hi all,
    In SQL, for example we have a group function like:
    select  district,state, country, continent, sum(no.of people) from world.
    Now, How to implement this group function in crystal reports? Please advise.
    Thanks in advance..
    Regards,
    sriram

    Hi Vinay,
    Thanks for the prompt reply.
    In one of our report, we are supposed to perform group by for 14 columns to get sum of 3 columns and there by displaying 17 columns in the report.
    When we tried in crystal reports to implement this oracle group by functionality:
    1. We created 14 groups from the Insert->Group option.
    2. By performing this, we got 14 group sections vertically(one inside the other).
    3. Then we created the sum(15th column),sum(16th column), sum(17th column)  by Insert->Summary option.
    4. We suppresed all the group sections except for the last group.
    5. Then, dragged all the groups to the last group section along with the summary fields.
    This is how, we tried to acheive the oracle group by function in Crystal reports.
    Please advise, whether our approach is right. If not, please suggest the appropriate approach with a bit detailed explanation.
    Thanks,
    Sriram.

  • Goup by in oracle vs group function in coldfusion

    Hello
    what is the difference between goup by in oracle vs group
    function in coldfusion?

    It's easier to list the similarities:
    Both use the word "group".
    Other than that: they're different things.
    Both are well documented in their respective documentation
    sources (which
    are avaialble online). Suggest you read up.
    Adam

  • 10g - cache, report contains oracle user defined function

    hi, experts,
    from http://obiee101.blogspot.com/2008/07/obiee-cache-management.html
    Reasons Why a Query is Not Added to the Cache:
    •Non-cacheable SQL element. If a SQL request contains Current_Timestamp, Current_Time, Rand, Populate, or a parameter marker then it is not added to the cache.
    •Non-cacheable table. Physical tables in the Oracle BI Server repository can be marked 'noncacheable'. If a query references any non-cacheable table then the query results will not be added to the cache.
    •Cache hit. In general, if the query gets a cache hit on a previously cached query, then the results of the current query are not added to the cache. The exception is query hits that are aggregate roll-up hits.
    •Result set is too big.
    Query is cancelled. This can happen by explicit cancellation from Oracle BI Presentation Services or the Administration Tool, or implicitly through timeout.
    •Oracle BI Server is clustered. Queries that fall into the ‘cache seeding’ family are propagated throughout the cluster. Other queries continue to be stored locally. Therefore, even though a query may be put into the cache on Oracle BI Server node 1, it may not be on Oracle BI Server node 2.
    I would like to know
    if the request (report on dashboard) calls an oracle user defined function,  can the cache be created and saved for this report?
    thank you very much!

    Hi stephen,
    if the request (report on dashboard) calls an oracle user defined function, can the cache be created and saved for this report?Yes,it is cached.....function defined in database is called in OBIEE is cached and saved.
    More information and example can be found here http://oraclebizint.wordpress.com/2007/09/10/oracle-bi-ee-10133-support-for-native-database-functions-and-aggregates/
    Hope it helps you.Check all other questions you posted are answered?
    By,
    KK

  • Oracle XSL extensions functions

    Where can I find a list (and doc) of all the Oracle XSL extensions functions like ora:node-set?
    TIA
    Didier

    Please try this link:
    http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/appdev.920/a96621/adx05xsj.htm#1023311

  • Oracle General Ledger Functional

    Hi Team,
    Am new to Oracle General Ledger Functional.
    Even am new am working GL Support.
    I need some functional Guidance related Rates .
    Any one can guide me
    Regards,
    Sampath

    Hi AsifMuhammad),
    I want to send concurrent program output as a email attachment.
    Can you guide me how can we send.
    I have tried the following methods
    1.Shell script by using mailx/UUencode (but there are security Reasons  at my client side not to Use these commands)
    2.When am trying with Pl/sql its not picking/reading the attachment by passing request id as input.
    3.I have set the profile options (FND SMTP ),After setting these profiles am able to send as a body of mail but not as attachment.
    1.Please guide me how to send email attachment of completed request by passing request _id
    2.How can send attachment after completion it self.
    Regards,
    Sampath

  • SSRS with Oracle Stored Procedures, Functions and Packages

    Hi,
    I am working on a BI project. Here we are using PowerPivot to access data from Oracle DB and generate reports. Currently Client generates Few reports using Oracle Stored Procedures, Functions and Packages. We need to move everything to PowerPivot, so
    that user can generate all reports using same platform. But PowerPivot doesn'e support Oracle Stored Procedures, Functions and Packages. So we have decided to try those reports using SSRS.
    I have no knowledge about using SSRS which will call Oracle function/stored procedures/packages for generating reports.
    Can anybody help me in getting exact steps?
    Please let me know if my question is not clear enough.
    Thanks and Regards,
    SS

    Hi Visakh,
    Thanks for the detailed steps. My next question is:
    Is there any other way to develop such reports without using any development tool like Visual Studio? Our aim is to provide a self-serviced reporting platform where user don't need any technical knowledge.
    I am sorry I have no knowledge about SSRS and Oracle DB.Can you please have a look at my Oracle function and let me know whether it's possible to execute this using SSRS? (I am pasting one by one as there is a character limit.
    CREATE OR REPLACE TYPE obj_special_pass_cases
    AS OBJECT
          CLAIM_ID    NUMBER(12),
          claim_ref_no  VARCHAR2(20),
          OFFICER_NAME   VARCHAR2(201),
          SUBMIT_DT   VARCHAR2(10),
          ACC_DT   VARCHAR2(10),
          SP_ISSUE_DT   VARCHAR2(10),
          STATUS    VARCHAR2(30),
          SUB_STATUS   VARCHAR2(30),
          STATUS_LAST_UPDATE_DATE VARCHAR2(10),
          SP_EXP_DT VARCHAR2(10),
          INDUSTRY_CODE VARCHAR2(8),
          EMP_SSIC VARCHAR2(8),
          rel VARCHAR2(4),
          WPNo VARCHAR2(20),
          FIN VARCHAR2(9),
          PASSPORT_NO VARCHAR2(16),
          SPNo VARCHAR2(20),
          VictimName VARCHAR2(100),
          SP_EXT_PURPOSE VARCHAR2(100),
          ISSUE_SYSTEM VARCHAR2(4), 
          REPATRIATION_DATE VARCHAR2(10),
          SP_STATUS    VARCHAR2(30),
          SP_ISSUE_PURPOSE VARCHAR2(500)
    CREATE OR REPLACE TYPE tbl_special_pass_cases
       AS TABLE OF obj_special_pass_cases
    CREATE OR REPLACE TYPE obj_special_pass_casesNew
    AS OBJECT
          CLAIM_ID    NUMBER(12),
          claim_ref_no  VARCHAR2(20),
          OFFICER_NAME   VARCHAR2(201),
          SUBMIT_DT   VARCHAR2(10), /*Case Registration Date*/
          ACC_DT   VARCHAR2(10),
          SP_ISSUE_DT   VARCHAR2(10),
          calc_sp_issue_dt VARCHAR2(10),
          calc_sp_issue_dt_month VARCHAR2(2),
          calc_sp_issue_dt_year VARCHAR2(4),
          calc_Duration_Of_Stay VARCHAR2(4),
          STATUS    VARCHAR2(30),
          SUB_STATUS   VARCHAR2(30),
          STATUS_LAST_UPDATE_DATE VARCHAR2(10),
          lastUpdateDtMonth varchar2(2),
          lastUpdateDtYear varchar2(4),
          DurationOfUpdateDt VARCHAR2(4),
          SP_EXP_DT VARCHAR2(10),
          INDUSTRY_CODE VARCHAR2(8),
          EMP_SSIC VARCHAR2(8),
          rel VARCHAR2(4),
          WPNo VARCHAR2(20), /* New columns from here - SR */
          FIN VARCHAR2(9),
          PASSPORT_NO VARCHAR2(16),
          SPNo VARCHAR2(20),
          VictimName VARCHAR2(100),
          workerNationality VARCHAR2(20),
          employName VARCHAR2(200),
          reportType VARCHAR2(10),
          SP_EXT_PURPOSE VARCHAR2(100),
          ISSUE_SYSTEM VARCHAR2(4), /*IWPS, EIDS*/
          REPATRIATION_DATE VARCHAR2(10),
          SP_STATUS    VARCHAR2(30),
          SP_ISSUE_PURPOSE VARCHAR2(500)
    CREATE OR REPLACE TYPE tbl_special_pass_casesNew
       AS TABLE OF obj_special_pass_casesNew
       FUNCTION getListOfSpecialPassCases(
                  vRepatriationDateFrom VARCHAR2,
                  vRepatriationDateTo VARCHAR2,
                  vIncludeRepatriationDate VARCHAR2)
        RETURN tbl_special_pass_cases
        IS
          TYPE cur_typ IS REF CURSOR;
          SPECIAL_PASS_CASES_CUR cur_typ;
          vSQL1 VARCHAR2(4000);
          --vSQL1 VARCHAR2(4000) := 'SELECT DISTINCT(A.CLAIM_ID), A.CLAIM_REF_NO, A.STATUS, A.SUB_STATUS, A.OFFICER_NAME,  A.SUBMIT_DT, A.ACC_DT, A.vLatestUpdatedDate, A.INDUSTRY_CODE, A.ID_NO, A.vWorkerName, B.vSPWPNO, B.vFIN, B.vSPPassportNo,
    B.vSPIssueDate, B.vSPExpiryDate, B.vSPNo, DECODE(B.vSPExtensionPurpose,''1'',''WICB'',''2'',''RE-APPLICATION'',''3'',''POLICE'',''4'',''REPATRIATION'',''5'',''LRD'',''6'',''LATE RENEWAL'',''9'',''OTHERS'',''10'',''LATE EISSUANCE'',''13'',''FMMD'',''14'',''TMB
    PENDING REPATRIATION'',''15'',''TMB REPATRIATION'',''16'',''PENDING REPATRIATION (SB-F)'',''17'',''REPATRIATION (SB-F)'') vSPExtensionPurpose, B.vIssueSystem, B.vSPActualDepartDate, B.vSPStatus, DECODE(B.vSPIssuePurpose,''1'',''WICB'',''2'',''RE-APPLICATION'',''3'',''POLICE'',''4'',''REPATRIATION'',''5'',''LRD'',''6'',''LATE
    RENEWAL'',''9'',''OTHERS'',''10'',''LATE EISSUANCE'',''11'',''PENDING DOCUMENT VERIFICATION'',''12'',''LATE ERENEWAL'',''13'',''FMMD'',''14'',''TMB PENDING REPATRIATION'',''15'',''TMB REPATRIATION'',''16'',''PENDING REPATRIATION (SB-F)'',''17'',''REPATRIATION
    (SB-F)'') vSPIssuePurpose FROM (SELECT vSPWPNO, vFIN, vSPPassportNo, vSPIssueDate, vSPExpiryDate, vSPNo, vSPExtensionPurpose, vIssueSystem, vSPActualDepartDate, vSPStatus, vSPIssuePurpose FROM TABLE(IOSH_WIC_EXT_INTERFACE_PKG.getIWPSActiveSpecialPass) WHERE
    (vSPWPNO IS NOT NULL OR vFIN IS NOT NULL)) B JOIN (SELECT WC.CLAIM_ID CLAIM_ID, WC.CLAIM_REF_NO CLAIM_REF_NO, WC.STATUS STATUS,  WC.SUB_STATUS SUB_STATUS, TAS.LAST_NAME ||'' ''|| TAS.FIRST_NAME OFFICER_NAME,  to_char(trunc(IRN.SUBMIT_DT), ''dd/MM/yyyy'')
    SUBMIT_DT, TO_CHAR(trunc(decode(wc.assessmt_type,''OD-PI'',EV.OD_CONSULT_DT,''OD-TI'',ev.od_consult_dt,ECASE.acc_dt)), ''dd/MM/yyyy'') ACC_DT, (SELECT TO_CHAR(MAX(WCS.STATUS_START_DT), ''dd/MM/yyyy'') STATUS_LAST_UPDATE_DATE FROM WIC_CLAIM_STATUS WCS WHERE
    WCS.CLAIM_ID=WC.CLAIM_ID) vLatestUpdatedDate, EC.INDUSTRY_CODE INDUSTRY_CODE, EP.ID_NO ID_NO, EP.NAME vWorkerName FROM EVENT_PERSON EP, WIC_CLAIMS WC, TBL_AA_SUBJECT TAS, EVENT_COMPANY EC,EVENT_CASE ECASE,event_victim ev WHERE EP.ID_NO IS NOT NULL AND EP.DELETE_IND
    = ''F'' AND EP.INVOLVEMENT = ''VICTIM'' AND WC.EVENT_CASE_NO = EP.EVENT_CASE_NO AND WC.EVENT_PERSON_ID = EP.EVENT_PERSON_ID AND ep.event_person_id = ev.event_person_id (+) AND WC.ASSIGN_OFFICER_ID = TAS.SUBJECT_ID AND EC.EVENT_CASE_NO=WC.EVENT_CASE_NO AND
    EC.INVOLVEMENT in (''EMPLOYER'',''EMPLOYER_OCCUPIER'') AND ECASE.EVENT_CASE_NO=WC.EVENT_CASE_NO AND EC.DELETE_IND = ''F'') A ON (B.vFIN = A.ID_NO OR B.vSPPassportNo = A.ID_NO)';
          vSQL2 VARCHAR2(4000);
          --vSQL2 VARCHAR2(4000) := 'SELECT DISTINCT(A.CLAIM_ID),A.CLAIM_REF_NO,A.STATUS,A.SUB_STATUS,A.OFFICER_NAME,A.SUBMIT_DT,A.ACC_DT,A.vLatestUpdatedDate,A.INDUSTRY_CODE,A.ID_NO,A.vWorkerName,B.vSPWPNO,B.vFIN,B.vSPPassportNo,B.vSPIssueDate,B.vSPExpiryDate,B.vSPNo,DECODE(B.vSPExtensionPurpose,''1'',''WICB'',''2'',''RE-APPLICATION'',''3'',''POLICE'',''4'',''REPATRIATION'',''5'',''LRD'',''6'',''LATE
    RENEWAL'',''9'',''OTHERS'',''10'',''LATE EISSUANCE'',''13'',''FMMD'',''14'',''TMB PENDING REPATRIATION'',''15'',''TMB REPATRIATION'',''16'',''PENDING REPATRIATION (SB-F)'',''17'',''REPATRIATION (SB-F)'') vSPExtensionPurpose,B.vIssueSystem,B.vSPActualDepartDate,B.vSPStatus,DECODE(B.vSPIssuePurpose,''1'',''WICB'',''2'',''RE-APPLICATION'',''3'',''POLICE'',''4'',''REPATRIATION'',''5'',''LRD'',''6'',''LATE
    RENEWAL'',''9'',''OTHERS'',''10'',''LATE EISSUANCE'',''11'',''PENDING DOCUMENT VERIFICATION'',''12'',''LATE ERENEWAL'',''13'',''FMMD'',''14'',''TMB PENDING REPATRIATION'',''15'',''TMB REPATRIATION'',''16'',''PENDING REPATRIATION (SB-F)'',''17'',''REPATRIATION
    (SB-F)'') vSPIssuePurpose FROM (SELECT vSPWPNO,vFIN,vSPPassportNo,vSPIssueDate,vSPExpiryDate,vSPNo,vSPExtensionPurpose,vIssueSystem,vSPActualDepartDate,vSPStatus,vSPIssuePurpose FROM TABLE(IOSH_WIC_EXT_INTERFACE_PKG.getIWPSDepartedSpecialPass(''' || vRepatriationDateFrom
    || ''', ''' ||  vRepatriationDateTo || ''')) WHERE (vSPWPNO IS NOT NULL OR vFIN IS NOT NULL)) B JOIN (SELECT WC.CLAIM_ID CLAIM_ID, WC.CLAIM_REF_NO CLAIM_REF_NO, WC.STATUS STATUS,WC.SUB_STATUS SUB_STATUS, TAS.LAST_NAME ||'' ''|| TAS.FIRST_NAME OFFICER_NAME, 
    to_char(trunc(IRN.SUBMIT_DT), ''dd/MM/yyyy'') SUBMIT_DT,TO_CHAR(trunc(decode(wc.assessmt_type,''OD-PI'',EV.OD_CONSULT_DT,''OD-TI'',ev.od_consult_dt,ECASE.acc_dt)), ''dd/MM/yyyy'') ACC_DT, (SELECT TO_CHAR(MAX(WCS.STATUS_START_DT), ''dd/MM/yyyy'') STATUS_LAST_UPDATE_DATE
    FROM WIC_CLAIM_STATUS WCS WHERE WCS.CLAIM_ID=WC.CLAIM_ID) vLatestUpdatedDate, EC.INDUSTRY_CODE INDUSTRY_CODE, EP.ID_NO ID_NO, EP.NAME vWorkerName FROM EVENT_PERSON EP, WIC_CLAIMS WC, TBL_AA_SUBJECT TAS, EVENT_COMPANY EC,EVENT_CASE ECASE, IR_NOTIFICATION IRN,event_victim
    ev WHERE EP.ID_NO IS NOT NULL AND EP.DELETE_IND = ''F'' AND EP.INVOLVEMENT = ''VICTIM'' AND WC.EVENT_CASE_NO = EP.EVENT_CASE_NO AND WC.EVENT_PERSON_ID = EP.EVENT_PERSON_ID and ep.event_person_id = ev.event_person_id (+) AND WC.ASSIGN_OFFICER_ID = TAS.SUBJECT_ID
    AND EC.EVENT_CASE_NO=WC.EVENT_CASE_NO AND EC.INVOLVEMENT in (''EMPLOYER'',''EMPLOYER_OCCUPIER'') AND ECASE.EVENT_CASE_NO=WC.EVENT_CASE_NO AND IRN.REF_NO(+) = ECASE.IR_REF_NO AND IRN.SUBMIT_TYPE IN (''SI'',''SE'') AND EC.DELETE_IND = ''F'') A ON (B.vFIN = A.ID_NO
    OR B.vSPPassportNo = A.ID_NO)';
          SPECIAL_PASS_CASES_TBL tbl_special_pass_cases := tbl_special_pass_cases();
       cursor sp_pass_settle_cur is
       SELECT DISTINCT (A.CLAIM_ID),
                    A.CLAIM_REF_NO,
                    A.STATUS,
                    A.SUB_STATUS,
                    A.OFFICER_NAME,
                    A.SUBMIT_DT,
                    A.ACC_DT,
                    A.vLatestUpdatedDate,
                    A.INDUSTRY_CODE,
                    A.ID_NO,
                    A.vWorkerName,
                    B.vSPWPNO,
                    B.vFIN,
                    B.vSPPassportNo,
                    B.vSPIssueDate,
                    B.vSPExpiryDate,
                    B.vSPNo,
                    DECODE(B.vSPExtensionPurpose,
                           '1',
                           'WICB',
                           '2',
                           'RE - APPLICATION',
                           '3',
                           'POLICE',
                           '4',
                           'REPATRIATION',
                           '5',
                           'LRD',
                           '6',
                           'LATE RENEWAL',
                           '9',
                           'OTHERS',
                           '10',
                           'LATE EISSUANCE',
                           '13',
                           'FMMD',
                           '14',
                           'TMB PENDING REPATRIATION',
                           '15',
                           'TMB REPATRIATION',
                           '16',
                           'PENDING REPATRIATION(SB - F)',
                           '17',
                           'REPATRIATION(SB - F)') vSPExtensionPurpose,
                    B.vIssueSystem,
                    B.vSPActualDepartDate,
                    B.vSPStatus,
                    DECODE(B.vSPIssuePurpose,
                           '1',
                           'WICB',
                           '2',
                           'RE - APPLICATION',
                           '3',
                           'POLICE',
                           '4',
                           'REPATRIATION',
                           '5',
                           'LRD',
                           '6',
                           'LATE RENEWAL',
                           '9',
                           'OTHERS',
                           '10',
                           'LATE EISSUANCE',
                           '11',
                           'PENDING DOCUMENT VERIFICATION',
                           '12',
                           'LATE ERENEWAL',
                           '13',
                           'FMMD',
                           '14',
                           'TMB PENDING REPATRIATION',
                           '15',
                           'TMB REPATRIATION',
                           '16',
                           'PENDING REPATRIATION(SB - F)',
                           '17',
                           'REPATRIATION(SB - F)') vSPIssuePurpose
      FROM (SELECT vSPWPNO,
                   vFIN,
                   vSPPassportNo,
                   vSPIssueDate,
                   vSPExpiryDate,
                   vSPNo,
                   vSPExtensionPurpose,
                   vIssueSystem,
                   vSPActualDepartDate,
                   vSPStatus,
                   vSPIssuePurpose
              FROM TABLE(IOSH_WIC_EXT_INTERFACE_PKG.getIWPSActiveSpecialPass)
             WHERE (vSPWPNO IS NOT NULL OR vFIN IS NOT NULL)) B
      JOIN (SELECT WC.CLAIM_ID CLAIM_ID,
                   WC.CLAIM_REF_NO CLAIM_REF_NO,
                   WC.STATUS STATUS,
                   WC.SUB_STATUS SUB_STATUS,
                   TAS.LAST_NAME ||''|| TAS.FIRST_NAME OFFICER_NAME,
                   '' SUBMIT_DT,
                   TO_CHAR(trunc(decode(wc.assessmt_type,
                                        'OD-PI',
                                        EV.OD_CONSULT_DT,
                                        'OD-TI',
                                        ev.od_consult_dt,
                                        ECASE.acc_dt)),
                           'dd/MM/yyyy') ACC_DT,
                   (SELECT TO_CHAR(MAX(WCS.STATUS_START_DT), 'dd/MM/yyyy') STATUS_LAST_UPDATE_DATE
                      FROM WIC_CLAIM_STATUS WCS
                     WHERE WCS.CLAIM_ID = WC.CLAIM_ID) vLatestUpdatedDate,
                   EC.INDUSTRY_CODE INDUSTRY_CODE,
                   EP.ID_NO ID_NO,
                   EP.NAME vWorkerName
              FROM EVENT_PERSON   EP,
                   WIC_CLAIMS     WC,
                   TBL_AA_SUBJECT TAS,
                   EVENT_COMPANY  EC,
                   EVENT_CASE     ECASE,
                   event_victim   ev
             WHERE EP.ID_NO IS NOT NULL
               AND EP.DELETE_IND = 'F'
               AND EP.INVOLVEMENT = 'VICTIM'
               AND WC.EVENT_CASE_NO = EP.EVENT_CASE_NO
               AND WC.EVENT_PERSON_ID = EP.EVENT_PERSON_ID
               AND ep.event_person_id = ev.event_person_id(+)
               AND WC.ASSIGN_OFFICER_ID = TAS.SUBJECT_ID
               AND EC.EVENT_CASE_NO = WC.EVENT_CASE_NO
               AND EC.INVOLVEMENT in ('EMPLOYER', 'EMPLOYER_OCCUPIER')
               AND ECASE.EVENT_CASE_NO = WC.EVENT_CASE_NO
               AND EC.DELETE_IND = 'F') A ON (B.vFIN = A.ID_NO OR  B.vSPPassportNo = A.ID_NO);
       sp_pass_settle_rec sp_pass_settle_cur%rowtype;
       cursor sp_details_with_dt_cur is
     SELECT DISTINCT (A.CLAIM_ID),
                    A.CLAIM_REF_NO,
                    A.STATUS,
                    A.SUB_STATUS,
                    A.OFFICER_NAME,
                    A.SUBMIT_DT,
                    A.ACC_DT,
                    A.vLatestUpdatedDate,
                    A.INDUSTRY_CODE,
                    A.ID_NO,
                    A.vWorkerName,
                    B.vSPWPNO,
                    B.vFIN,
                    B.vSPPassportNo,
                    B.vSPIssueDate,
                    B.vSPExpiryDate,
                    B.vSPNo,
                    DECODE(B.vSPExtensionPurpose,'1','WICB', '2','RE - APPLICATION','3','POLICE','4','REPATRIATION','5','LRD','6','LATE RENEWAL','9','OTHERS','10','LATE EISSUANCE',
                           '13','FMMD','14','TMB PENDING REPATRIATION','15','TMB REPATRIATION','16','PENDING REPATRIATION(SB - F)','17','REPATRIATION(SB
    - F)') vSPExtensionPurpose,
                    B.vIssueSystem,
                    B.vSPActualDepartDate,
                    B.vSPStatus,
                    DECODE(B.vSPIssuePurpose,
                           '1','WICB','2','RE - APPLICATION','3','POLICE','4','REPATRIATION','5','LRD','6','LATE RENEWAL','9','OTHERS', '10', 'LATE EISSUANCE','11','PENDING
    DOCUMENT VERIFICATION',
                           '12','LATE ERENEWAL','13','FMMD','14','TMB PENDING REPATRIATION','15','TMB REPATRIATION','16','PENDING REPATRIATION(SB - F)','17','REPATRIATION(SB
    - F)') vSPIssuePurpose
      FROM (SELECT vSPWPNO,
                   vFIN,
                   vSPPassportNo,
                   vSPIssueDate,
                   vSPExpiryDate,
                   vSPNo,
                   vSPExtensionPurpose,
                   vIssueSystem,
                   vSPActualDepartDate,
                   vSPStatus,
                   vSPIssuePurpose
              FROM TABLE(IOSH_WIC_EXT_INTERFACE_PKG.getIWPSDepartedSpecialPass(''|| vRepatriationDateFrom ||'', ''||  vRepatriationDateTo ||''))
             WHERE (vSPWPNO IS NOT NULL OR vFIN IS NOT NULL)) B
      JOIN (SELECT WC.CLAIM_ID CLAIM_ID,
                   WC.CLAIM_REF_NO CLAIM_REF_NO,
                   WC.STATUS STATUS,
                   WC.SUB_STATUS SUB_STATUS,
                   TAS.LAST_NAME ||''|| TAS.FIRST_NAME OFFICER_NAME,
                   to_char(trunc(IRN.SUBMIT_DT), 'dd/MM/yyyy') SUBMIT_DT,
                   TO_CHAR(trunc(decode(wc.assessmt_type,
                                        'OD - PI',
                                        EV.OD_CONSULT_DT,
                                        'OD - TI',
                                        ev.od_consult_dt,
                                        ECASE.acc_dt)),
                           'dd/MM/yyyy') ACC_DT,
                   (SELECT TO_CHAR(MAX(WCS.STATUS_START_DT), 'dd/MM/yyyy') STATUS_LAST_UPDATE_DATE
                      FROM WIC_CLAIM_STATUS WCS
                     WHERE WCS.CLAIM_ID = WC.CLAIM_ID) vLatestUpdatedDate,
                   EC.INDUSTRY_CODE INDUSTRY_CODE,
                   EP.ID_NO ID_NO,
                   EP.NAME vWorkerName
              FROM EVENT_PERSON    EP,
                   WIC_CLAIMS      WC,
                   TBL_AA_SUBJECT  TAS,
                   EVENT_COMPANY   EC,
                   EVENT_CASE      ECASE,
                   IR_NOTIFICATION IRN,
                   event_victim    ev
             WHERE EP.ID_NO IS NOT NULL
               AND EP.DELETE_IND = 'F'
               AND EP.INVOLVEMENT = 'VICTIM'
               AND WC.EVENT_CASE_NO = EP.EVENT_CASE_NO
               AND WC.EVENT_PERSON_ID = EP.EVENT_PERSON_ID
               and ep.event_person_id = ev.event_person_id(+)
               AND WC.ASSIGN_OFFICER_ID = TAS.SUBJECT_ID
               AND EC.EVENT_CASE_NO = WC.EVENT_CASE_NO
               AND EC.INVOLVEMENT in ('EMPLOYER', 'EMPLOYER_OCCUPIER')
               AND ECASE.EVENT_CASE_NO = WC.EVENT_CASE_NO
               AND IRN.REF_NO(+) = ECASE.IR_REF_NO
               AND IRN.SUBMIT_TYPE IN ('SI', 'SE')
               AND EC.DELETE_IND = 'F') A ON (B.vFIN = A.ID_NO OR  B.vSPPassportNo = A.ID_NO);
         sp_details_with_dt_rec sp_details_with_dt_cur%rowtype;
          /*vSQL VARCHAR2(4000);
          vFIN  VARCHAR2(9);
          vSPPassportNo  VARCHAR2(16);
          vSPWPNO VARCHAR2(20);
          vSPIssueDate VARCHAR2(10);
          vSPExpiryDate VARCHAR2(10);
          vSPNo VARCHAR2(20);
          vSPExtensionPurpose VARCHAR2(100);
          vIssueSystem VARCHAR2(4);
          vSPActualDepartDate VARCHAR2(10);
          vSPStatus VARCHAR2(30);
          vSPIssuePurpose VARCHAR2(500);
          CLAIM_ID NUMBER(12);
          CLAIM_REF_NO VARCHAR2(20);
          STATUS VARCHAR2(30);
          SUB_STATUS VARCHAR2(30);
          OFFICER_NAME VARCHAR2(201);
          SUBMIT_DT VARCHAR2(10);
          ACC_DT VARCHAR2(10);
          vLatestUpdatedDate VARCHAR2(10);
          INDUSTRY_CODE VARCHAR2(8);
          ID_NO VARCHAR2(50);
          vWorkerName VARCHAR2(100);*/
        BEGIN
      if vIncludeRepatriationDate = 'Y' then
       for sp_details_with_dt_rec in sp_details_with_dt_cur
       loop
       SPECIAL_PASS_CASES_TBL.EXTEND;
       SPECIAL_PASS_CASES_TBL(SPECIAL_PASS_CASES_TBL.LAST) := obj_special_pass_cases(sp_details_with_dt_rec.CLAIM_ID,sp_details_with_dt_rec.CLAIM_REF_NO,sp_details_with_dt_rec.OFFICER_NAME,sp_details_with_dt_rec.SUBMIT_DT,sp_details_with_dt_rec.ACC_DT,sp_details_with_dt_rec.vSPIssueDate,sp_details_with_dt_rec.STATUS,sp_details_with_dt_rec.SUB_STATUS,sp_details_with_dt_rec.vLatestUpdatedDate,sp_details_with_dt_rec.vSPExpiryDate,sp_details_with_dt_rec.INDUSTRY_CODE,sp_details_with_dt_rec.INDUSTRY_CODE,'a',sp_details_with_dt_rec.vSPWPNO,sp_details_with_dt_rec.vFIN,sp_details_with_dt_rec.vSPPassportNo,sp_details_with_dt_rec.vSPNo,sp_details_with_dt_rec.vWorkerName,sp_details_with_dt_rec.vSPExtensionPurpose,sp_details_with_dt_rec.vIssueSystem,sp_details_with_dt_rec.vSPActualDepartDate,sp_details_with_dt_rec.vSPStatus,sp_details_with_dt_rec.vSPIssuePurpose);
       end loop;
      else
       for sp_pass_settle_rec in sp_pass_settle_cur
       loop
       SPECIAL_PASS_CASES_TBL.EXTEND;
       SPECIAL_PASS_CASES_TBL(SPECIAL_PASS_CASES_TBL.LAST) := obj_special_pass_cases(sp_pass_settle_rec.CLAIM_ID,sp_pass_settle_rec.CLAIM_REF_NO,sp_pass_settle_rec.OFFICER_NAME,sp_pass_settle_rec.SUBMIT_DT,sp_pass_settle_rec.ACC_DT,sp_pass_settle_rec.vSPIssueDate,sp_pass_settle_rec.STATUS,sp_pass_settle_rec.SUB_STATUS,sp_pass_settle_rec.vLatestUpdatedDate,sp_pass_settle_rec.vSPExpiryDate,sp_pass_settle_rec.INDUSTRY_CODE,sp_pass_settle_rec.INDUSTRY_CODE,'a',sp_pass_settle_rec.vSPWPNO,sp_pass_settle_rec.vFIN,sp_pass_settle_rec.vSPPassportNo,sp_pass_settle_rec.vSPNo,sp_pass_settle_rec.vWorkerName,sp_pass_settle_rec.vSPExtensionPurpose,sp_pass_settle_rec.vIssueSystem,sp_pass_settle_rec.vSPActualDepartDate,sp_pass_settle_rec.vSPStatus,sp_pass_settle_rec.vSPIssuePurpose);
       end loop;
      end if ;
        RETURN SPECIAL_PASS_CASES_TBL;
      END getListOfSpecialPassCases;
    Thanks,
    SS

  • Item Conversion Template Issue for Oracle Migration - Copy functionality

    Hi,
    I am working on Migration project which is from Radius ERP to Oracle 11.5.10.2.
    Currently working on Item Conversion. This Item conversion having the fileds like (ORGANIZATION_ID,SEGMENT1,DESCRIPTION,ITEM_TYPE,COST_OF_SALES_ACCOUNT,SALES_ACCOUNT,ATTRIBUTE_CATEGORY,ATTRIBUTE1,ATTRIBUTE2,ATTRIBUTE3,ATTRIBUTE4,ATTRIBUTE5,ATTRIBUTE6,ATTRIBUTE7,ATTRIBUTE8,ATTRIBUTE9,ATTRIBUTE10,ATTRIBUTE11,ATTRIBUTE12,ATTRIBUTE13,ATTRIBUTE14,ATTRIBUTE15,GLOBAL_ATTRIBUTE10,REF_INVENTORY_ITEM_ID,REF_ORGANIZATION_ID).
    I have validated those fields and loaded into interfacing to Oracle Successfully in the master Org and Validated through Frontend.
    when I close the form, I will be receiving the below warning message and telling that Template id needs to be assign to the item before assigning item to the Org. The message is showing like
    "*You have not applied a template to this item, please apply a template before assigning this item to an ORG.*"
    Please find the below package which I wrote for this conversion requirement.
    The customer is saying like need to achieve the copy functionality based on the "REF_INVENTORY_ITEM_ID and REF_ORGANIZATION_ID".
    The Issue is am not able to handle the copy functionality and getting above message. kindly refer the package and suggest me where i am doing the mistake. Its high priority issue for me.
    Thanks in advance.
    CREATE OR REPLACE PACKAGE APPS.xxxx_inv_items_conv_pkg
    AS
    PROCEDURE xxx_item_conversion_proc (
    errbuf OUT VARCHAR2,
    retcode OUT VARCHAR2,
    p_org_id IN NUMBER,
    -- p_commit_point IN NUMBER,
    p_load_code IN VARCHAR2
    IS
    <<Local Variables Declaration>> <<For space limit deleted these variables>>
    CURSOR cur_item_master (pc_org_code VARCHAR2)
    IS
    SELECT itemstg.*
    FROM xxx_inv_system_items_stg itemstg
    WHERE itemstg.organization_id = pc_org_code
    AND itemstg.status_flag IS NULL;
    CURSOR cur_item_master_dup (pc_org_code VARCHAR2)
    IS
    SELECT itemstg.segment1, itemstg.organization_id
    FROM xxx_inv_system_items_stg itemstg
    WHERE itemstg.ROWID <
    (SELECT MAX (b.ROWID)
    FROM xxx_inv_system_items_stg b
    WHERE b.segment1 = itemstg.segment1
    AND b.organization_id = itemstg.organization_id
    AND b.organization_id = pc_org_code
    AND itemstg.status_flag IS NULL
    AND b.status_flag IS NULL);
    BEGIN
    IF p_load_code = 'Insert'
    THEN
    l_transaction_type := 'CREATE'; -- Default Value in I/F Table
    ELSIF p_load_code = 'Update'
    THEN
    l_transaction_type := 'UPDATE'; -- Default Value in I/F Table
    END IF;
    DBMS_OUTPUT.put_line ( 'Validation Starts At :'
    || TO_CHAR (SYSDATE, 'DD-MON-YYYY HH24:MI:SS')
    --Checking for Duplicate Records items
    BEGIN
    UPDATE xxx_inv_system_items_stg a
    SET a.status_flag = 'E',
    a.error_message = 'Duplicate Record'
    WHERE a.ROWID >
    ANY (SELECT b.ROWID
    FROM xxx_inv_system_items_stg b
    WHERE a.segment1 = b.segment1
    AND a.organization_id = b.organization_id)
    AND a.organization_id = p_org_id
    AND a.status_flag IS NULL;
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line ('Exception in updating duplicates'
    || SQLERRM
    END;
    DBMS_OUTPUT.put_line ('CheckPoint: Duplicate Record');
    BEGIN
    SELECT organization_id
    INTO l_organization_id
    FROM org_organization_definitions
    WHERE organization_id = p_org_id;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    DBMS_OUTPUT.PUT_LINE(p_org_id||' Org Does Not Exist');
    -- p_retcode := '2';
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.PUT_LINE('Exception in Getting Org Id'||'Cannot Proceed');
    -- p_retcode := '2';
    END ;
    DBMS_OUTPUT.put_line ('CheckPoint: Orgcode' || l_organization_id);
    /* IF p_retcode = '2'
    THEN
    RETURN;
    END IF;*/
    --Block             : Setting Master and Validation Orgs Flags
    BEGIN
    SELECT DECODE (master_organization_id, l_organization_id, 'Y', 'N'),
    master_organization_id
    INTO l_master_org,
    l_master_org_id
    FROM mtl_parameters
    WHERE organization_id = l_organization_id;
    EXCEPTION
    WHEN OTHERS
    THEN
    l_master_org := 'N';
    l_master_org_id := NULL;
    DBMS_OUTPUT.PUT_LINE(p_org_id||' Org Does Not Exist');
    END ;
    DBMS_OUTPUT.put_line ('master_organization_id');
    SELECT fnd_profile.VALUE ('USER_ID')
    INTO l_user_id
    FROM DUAL;
    -- Block : Set the SET_PROCESS_ID
    l_set_process_id := l_organization_id;
    l_insert_count := 0;
    LOOP
    BEGIN
    SELECT COUNT (segment1)
    INTO l_insert_count
    FROM mtl_system_items_interface
    WHERE set_process_id = l_set_process_id
    AND transaction_type = l_transaction_type
    AND process_flag = 1;
    EXCEPTION
    WHEN OTHERS
    THEN
    l_insert_count := 0;
    END;
    EXIT WHEN l_insert_count = 0;
    l_set_process_id := l_set_process_id + 10;
    END LOOP;
    DBMS_OUTPUT.put_line ('SET PROCESS ID -l_insert_count ' || l_insert_count);
    IF p_load_code = 'Insert'
    THEN
    BEGIN
    FOR recitem_data IN cur_item_master_dup (p_org_id)
    LOOP
    UPDATE xxx_inv_system_items_stg
    SET status_flag = l_processed_flag,
    error_message = l_error_message
    WHERE segment1 = recitem_data.segment1
    AND organization_id = recitem_data.organization_id
    AND status_flag IS NULL;
    COMMIT;
    END LOOP;
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line ( 'Update of Duplicates Failed : '
    || SQLCODE
    || '--'
    || SQLERRM
    END ;
    END IF;
    FOR recitem_data IN cur_item_master (p_org_id)
    LOOP
    <<Local Variables Declaration>> <<For space limit deleted these variables>>
    IF p_load_code = 'Update'
    THEN
    l_error_message := 'Update Mode' || l_error_delimiter;
    END IF;
    --l_count := -1;
    BEGIN
    DBMS_OUTPUT.put_line ('CheckPoint: ItemValidationStart');
    SELECT DISTINCT inventory_item_id,
    restrict_subinventories_code,
    restrict_locators_code
    INTO l_inventory_item_id,
    l_restrict_subinventories_code,
    l_restrict_locators_code
    FROM apps.mtl_system_items_b msi
    WHERE msi.organization_id = l_organization_id
    AND msi.segment1 = UPPER (recitem_data.segment1);
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    l_count := 0;
    -- l_processed_flag := 'F';
    DBMS_OUTPUT.put_line ('inventory_item_id - AFTER MAIN LOOP' || l_inventory_item_id||'-'||l_processed_flag);
    DBMS_OUTPUT.put_line ('inventory_item_id - AFTER MAIN LOOP' || l_inventory_item_id||'-'||recitem_data.ref_inventory_item_id);
    WHEN OTHERS
    THEN
    l_count := -1;
    -- l_processed_flag := 'F';
    DBMS_OUTPUT.put_line ('inventory_item_id - AFTER MAIN LOOP' || l_inventory_item_id||'-'||l_processed_flag);
    END ;
    DBMS_OUTPUT.put_line ('inventory_item_id - AFTER MAIN LOOP'||recitem_data.ref_inventory_item_id);
    IF l_count = -1
    THEN
    l_processed_flag := 'F';
    l_error_message :=
    l_error_message
    || 'Exception - Checking Item already Present'
    || l_error_delimiter;
    DBMS_OUTPUT.put_line ('Exception - Checking Item already Present'||l_processed_flag);
    ELSIF (l_count > 0 AND p_load_code = 'Insert')
    THEN
    l_processed_flag := 'F';
    l_error_message :=
    l_error_message
    || 'Item Already Exists In '
    || p_org_id
    || ' Organization '
    || l_error_delimiter;
    DBMS_OUTPUT.put_line ('Exception - Checking Item already Present1'||l_processed_flag);
    ELSIF (l_count = 0 AND p_load_code = 'Update')
    THEN
    l_processed_flag := 'F';
    l_error_message :=
    l_error_message
    || 'Item Not Present In '
    || p_org_id
    || ' Organization '
    || l_error_delimiter;
    DBMS_OUTPUT.put_line ('Exception - Checking Item already Present2'||l_processed_flag);
    END IF;
    BEGIN
    SELECT count(*)
    INTO l_seg_count
    FROM apps.mtl_system_items_b msi
    WHERE msi.organization_id = l_organization_id
    AND msi.segment1 = UPPER (recitem_data.segment1);
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    l_seg_count := 0;
    l_processed_flag:='F';
    l_error_message :=
    l_error_message
    || 'Item Not Present In Oracle'
    || p_org_id
    || ' Organization '
    || l_error_delimiter;
    DBMS_OUTPUT.put_line ('inventory_item_id - l_seg_count ' ||l_seg_count||'-'||l_processed_flag );
    WHEN OTHERS
    THEN
    l_seg_count := -1;
    l_processed_flag:='F';
    l_error_message :=
    l_error_message
    || 'Item Not Present In Oracle'
    || p_org_id
    || ' Organization '
    || l_error_delimiter;
    END ;
    IF p_load_code = 'Insert'
    THEN
    IF l_organization_id != l_master_org_id
    THEN
    BEGIN
    SELECT COUNT (1)
    INTO l_org_item_count
    FROM apps.mtl_system_items_b msi
    WHERE msi.organization_id = l_master_org_id
    AND msi.segment1 = UPPER (recitem_data.segment1);
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    l_org_item_count := 0;
    DBMS_OUTPUT.put_line ('l_org_item_count ' ||l_org_item_count||'-'||l_processed_flag );
    WHEN OTHERS
    THEN
    l_org_item_count := -1;
    END ;
    IF l_org_item_count = -1
    THEN
    l_processed_flag := 'F';
    l_error_message :=
    l_error_message
    || 'Exception - Checking Item in Master '
    || l_error_delimiter;
    ELSIF l_org_item_count = 0
    THEN
    l_processed_flag := 'F';
    l_error_message :=
    l_error_message
    || 'Item Does Not Exist in Master '
    || l_error_delimiter;
    END IF;
    END IF;
    END IF;
    DBMS_OUTPUT.put_line ( 'CheckPoint: Iteminmasterorg'
    || l_org_item_count
    IF (recitem_data.description IS NULL AND p_load_code = 'Insert')
    THEN
    l_processed_flag := 'F';
    l_error_message :=
    l_error_message || 'Description is NULL' || l_error_delimiter;
    END IF;
    IF (recitem_data.sales_account IS NOT NULL)
    THEN
    BEGIN
    SELECT code_combination_id
    INTO l_sales_account
    FROM gl_code_combinations_kfv
    WHERE code_combination_id= recitem_data.sales_account;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    -- l_processed_flag := 'F'; --QUESTION
    l_error_message :=
    l_error_message
    || 'Sales Account Not Setup '
    || l_error_delimiter;
    DBMS_OUTPUT.put_line ( 'CheckPoint: Salesacct_Validation'
    || l_sales_account||'-'||l_processed_flag
    WHEN OTHERS
    THEN
    l_processed_flag := 'F';
    l_error_message :=
    l_error_message
    || 'Sales Account Exception '
    || SQLERRM
    || l_error_delimiter;
    DBMS_OUTPUT.put_line ( 'CheckPoint: Salesacct_Validation'
    || l_sales_account||'-'||l_processed_flag
    END ;
    END IF;
    IF (recitem_data.cost_of_sales_account IS NOT NULL)
    THEN
    BEGIN
    SELECT code_combination_id
    INTO l_cost_of_sales_account
    FROM gl_code_combinations_kfv
    WHERE code_combination_id =
    recitem_data.cost_of_sales_account;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    l_processed_flag := 'F';
    l_error_message :=
    l_error_message
    || 'COGS Account Not Setup '
    || l_error_delimiter;
    DBMS_OUTPUT.put_line ( 'l_cost_of_sales_account'
    || l_cost_of_sales_account||'-'||l_processed_flag
    WHEN OTHERS
    THEN
    l_processed_flag := 'F';
    l_error_message :=
    l_error_message
    || 'COGS Account Exception '
    || SQLERRM
    || l_error_delimiter;
    DBMS_OUTPUT.put_line ( 'l_cost_of_sales_account'
    || l_cost_of_sales_account||'-'||l_processed_flag
    END check_cogs_account;
    END IF;
    BEGIN
    select distinct organization_code
    into l_ref_org_code
    from org_organization_definitions
    where organization_id = recitem_data.ref_organization_id ;
    EXCEPTION
    WHEN OTHERS THEN
    l_ref_org_code:= NULL;
    l_processed_flag:='F';
    l_error_message :=
    l_error_message
    || 'Reference Org Not Present'
    || p_org_id
    || ' Organization '
    || l_error_delimiter ;
    DBMS_OUTPUT.put_line ('l_ref_org_code'|| l_ref_org_code||'-'||l_processed_flag);
    END;
    BEGIN
    select concatenated_segments
    into l_ref_inventory_item_code
    from mtl_system_items_kfv
    where inventory_item_id = recitem_data.ref_inventory_item_id
    and organization_id = recitem_data.ref_organization_id ;
    EXCEPTION
    WHEN OTHERS THEN
    l_ref_inventory_item_code :=NULL;
    l_processed_flag:='F';
    l_error_message :=
    l_error_message
    || 'Reference Item Not Present'
    || p_org_id
    || ' Organization '
    || l_error_delimiter;
    DBMS_OUTPUT.put_line ('l_ref_inventory_item_code'|| l_ref_inventory_item_code||'-'||l_processed_flag);
    END;
    IF (l_master_org = 'N' AND p_load_code = 'Insert')
    THEN
    BEGIN
    SELECT count(*)
    INTO l_description_count
    FROM mtl_system_items_tl
    WHERE organization_id = l_master_org_id
    AND inventory_item_id =
    (SELECT inventory_item_id
    FROM mtl_system_items_b
    WHERE organization_id = l_master_org_id
    AND segment1 = recitem_data.segment1);
    END ;
    IF l_description_count > 0 THEN
    l_processed_flag:='F';
    l_error_message :=
    l_error_message
    || 'Item Description Not Present'
    || p_org_id
    || ' Organization '
    || l_error_delimiter;
    END IF;
    END IF;
    IF l_processed_flag = 'S'
    THEN
    BEGIN
    INSERT INTO mtl_system_items_interface
    (organization_id,
    segment1,
    description,
    ITEM_TYPE,
    COST_OF_SALES_ACCOUNT,
    SALES_ACCOUNT,
    attribute_category,
    set_process_id,
    transaction_type,
    process_flag,
    copy_organization_code,
    copy_item_number,
    creation_date,
    created_by,
    last_updated_by,
    last_update_date
    --attribute_category
    , attribute1
    , attribute2
    ,attribute3
    ,attribute4
    ,attribute5
    ,attribute6
    ,attribute7
    ,attribute8
    ,attribute9
    ,attribute10
    ,attribute11
    ,attribute12
    ,attribute13
    ,attribute14
    ,attribute15
    ,global_attribute10
    VALUES (l_organization_id,
    recitem_data.segment1,
    recitem_data.description,
    recitem_data.ITEM_TYPE,
    recitem_data.COST_OF_SALES_ACCOUNT,
    recitem_data.SALES_ACCOUNT,
    recitem_data.ATTRIBUTE_CATEGORY,
    l_set_process_id,
    l_transaction_type, --,l_transaction_type
    l_process_flag,
    l_ref_org_code,
    l_ref_inventory_item_code,
    SYSDATE, l_user_id,
    l_user_id, SYSDATE
    -- l_attribute_category
    ,recitem_data.attribute1
    ,recitem_data.attribute2
    ,recitem_data.attribute3
    ,recitem_data.attribute4
    ,recitem_data.attribute5
    ,recitem_data.attribute6
    ,recitem_data.attribute7
    , recitem_data.attribute8
    ,recitem_data.attribute9
    , recitem_data.attribute10
    ,recitem_data.attribute11
    ,recitem_data.attribute12
    ,recitem_data.attribute13
    ,recitem_data.attribute14
    ,recitem_data.attribute15
    , substr(recitem_data.global_attribute10,1,length(recitem_data.global_attribute10)-1) --recitem_data.global_attribute10
    l_insert_count := l_insert_count + 1;
    /* IF (l_insert_count = NVL (p_commit_point, 10000))
    THEN
    -- l_set_process_id := l_set_process_id + 10; -- REVERT BACK CHANGE
    l_insert_count := 0;
    END IF;
    EXCEPTION
    WHEN OTHERS
    THEN
    l_processed_flag := 'F';
    l_error_message :=
    l_error_message
    || 'Error in Inserting Item '
    || SQLERRM
    || l_error_delimiter;
    END ;
    COMMIT;
    DBMS_OUTPUT.put_line ('CheckPoint: Insertion Completed in Intfacetable');
    END IF;
    BEGIN
    UPDATE xxx_inv_system_items_stg
    SET status_flag = l_processed_flag,
    error_message = l_error_message
    WHERE segment1 = recitem_data.segment1
    AND organization_id = recitem_data.organization_id
    AND status_flag IS NULL;
    COMMIT;
    DBMS_OUTPUT.put_line ('Error Message'||l_error_message);
    EXCEPTION
    WHEN OTHERS
    THEN
    fnd_file.put_line (fnd_file.LOG,
    'Error:Updating Item:'
    || SQLCODE
    || '-'
    || SQLERRM
    END;
    END LOOP; --FOR recitem_data IN cur_item_master
    DBMS_OUTPUT.put_line ( 'Validation Ends At :'
    || TO_CHAR (SYSDATE, 'DD-MON-YYYY HH24:MI:SS')
    DBMS_OUTPUT.put_line ('Number of records inserted into Table Successfully -->'|| l_insert_count);
    END;
    END xxxx_inv_items_conv_pkg;
    Edited by: 896170 on Apr 12, 2013 11:58 PM

    Issue got solved... changed the PO line amount as:
    <?xdoxslt:set_variable($_XDOCTX,'line_amt',xdoxslt:to_number(LINE_AMOUNT))?>
    Reference :Syntax for 'to_number'
    Regards
    Manikanta Panigrahi

  • How to distinguish the User-Defined-Function from Oracle Build-In function

    Hi Friends,
    I could get the function list form all_objects table by the SQL:
    select * from all_objects where object_type = 'FUNCTION'
    but there is no column in all_objects specify the function is build-in or user-defined.
    But I found in SQL Server there is a column "is_ms_shipped" in the sys.all_objects table. This column will specify the object is build-in or user-defined. I want to get the equivalent column in Oracle but failed.
    Could anyone tell me how to solve this problem?
    Thanks,
    Ricky

    Thanks Pavan.
    But if an user connects to database using "conn /as sysdba" syntax and creates a function. This user-defined funtion goes into the "SYS" schema also. I know it is not the best practise to create objects using sys user so I think your solution is right.
    Regards,
    Ricky

  • Oracle UI Shell Functional Pattern

    Problem Description
    A chief challenge in UI development is rational consistency -- providing the user with predictable locations and behaviors for the most salient features.
    Technical Pattern Description
    The Oracle ADF UI Shell is a template that provides guidance to development teams working towards a consistent UI for their customers. Because it is reinforced in code, it augments the probability that UI specifications will be followed. The primary assumption of the Oracle ADF UI Shell is that each page based on the template will represent a significant module of an application, if not separate applications. As a consequence, the "boilerplate" portion of the UI (e.g., branding, ubiquitous controls, obligatory legal statements) are more easily held consistent in form, placement, and function -- as they are defined once. The more interactive portion of the application -- features and functions that define the application -- are presented in the "workarea" of the template. The Oracle ADF UI Shell template identifies those areas through named facets (e.g., navigation) and regions (e.g., dynamic tabs). Nearly all, if not all, of the product's value add can be surfaced in regions of a single page as bounded ADF taskflows. In the end, customers enjoy a more predictable user experience.
    Click here to see the document that describes this pattern.

    I have already tested my understanding on the taskFlow binding "*parametersMap*" attribute above and it works!
    First, I added an additional parameter in line with the tabContext parameter to my custom dynamicTabShellDefinition.xml. The parameter binding section will be as follows:
    <parameters>
        <parameter id="tabContext" value="${viewScope.tabContext}"/>
        <parameter id="parameterMap" value="${requestScope.parameterMap}"/>
      </parameters>Note that instead of using ${viewScope.parameterMap}, I used ${requestScope.parameterMap} because it seems that when I passed a viewScope parameter from a backingBean inside one of my bounded task flows, it will not reach the initialization of my target task flow in the separate tab.
    Second, I redefined all my taskFlow bindings to define the "*parametersMap*" attribute value to "*#{bindings.parameterMap}*". Please see below a redefined taskFlow definition:
    <taskFlow id="r0"
                  taskFlowId="${viewScope.tabContext.taskflowIds[0]}"
                  activation="deferred"
                  xmlns="http://xmlns.oracle.com/adf/controller/binding"
                  parametersMap="#{bindings.parameterMap}">
          <parameters>
            <parameter id="tabContext" value="${bindings.tabContext}"
                       xmlns="http://xmlns.oracle.com/adfm/uimodel"/>
          </parameters>
    </taskFlow>With the steps above, I could already define any parameter that I need in the bounded taskflow: Please see below for a sample parameter definition:
    <input-parameter-definition id="__2">
          <name id="__3">employeeId</name>
          <value>#{pageFlowScope.employeeId}</value>
          <required/>
    </input-parameter-definition>Just be sure that before you invoke the backing bean method that will call the TabContext addTab() method you already put the employeeId into the parameterMap and set the parameterMap into requestScope:
            Map<String, Object> parameterMap = new HashMap<String, Object>();
            parameterMap.put("employeeId",employee.getId());
            JSFUtils.setRequestAttribute("parameterMap", parameterMap);//JSFUtils is a utility class from FOD
            //direct or indirect call to the TabContext addTab() method hereI hope this will help others too.
    regards,
    pino

  • Oracle 11g Table function returns no records on first call

    Hello,
    On a Oracle 11g R2 I've a table function ( PIPELINED ) returning rows selected from a table.
    The first time the function is selected, in a session ( I've tried to disconnect and log in again ), it returns no rows.
    I've tried to log the call using DBMS_OUTPUT and from what I see the select on the table function returns no rows and no output is printed. So I presume Oracle is not calling the function.
    The same function on a similar environment ( same db versions, patches and database structure ) works fine. The second environment is a production environment so it has more memory and some other settings enabled.
    Does anyone know of settings that can relate to this behaviour ?
    Thanks in advance for the help.
    Regards,
    Stefano Muret

    Thank you for answering so fast.
    Here's the function code:
    FUNCTION template_parameters (iTemplate IN TEMPLATE_RAW_DATA.TMPL_ID%TYPE := NULL)
    RETURN table_type_tmpl_parameters PIPELINED
    IS
    li_exception INTEGER DEFAULT -20025;
    POUT_PARM TABLE_TYPE_TMPL_PARAMETERS;
    lt_parms table_type_tmpl_parms_raw;
    sParmCheck VARCHAR2(4000);
    iOccurrence INTEGER;
    BEGIN
    pOut_Parm := table_type_tmpl_parameters();
    pOut_Parm.EXTEND;
    select
    tmpl_id
    *,tmpl_name*
    *,replace(upper(trim(sql_out)),'[SCHEMA].')*
    *,UPPER(TRIM(out_tmpl_parms))*
    bulk collect into lt_parms
    from ref_templates
    where tmpl_id = NVL(iTemplate,tmpl_id)
    order by tmpl_id;
    FOR k IN 1..lt_parms.COUNT
    LOOP
    pOut_Parm(1).tmpl_id := lt_parms(k).tmpl_id;
    pOut_Parm(1).tmpl_name := lt_parms(k).tmpl_name;
    FOR i IN 1..2
    LOOP
    IF i = 1 THEN
    sParmCheck := lt_parms(k).sql_out;
    ELSE
    sParmCheck := lt_parms(k).sql_parms;
    END IF;
    iOccurrence := 1;
    *pOut_Parm(1).parameter_name := regexp_substr(sParmCheck,'\[[^\[]+\]',1,iOccurrence);*
    WHILE pOut_Parm(1).parameter_name IS NOT NULL
    LOOP
    PIPE ROW (pOut_Parm(1));
    iOccurrence := iOccurrence + 1;
    *pOut_Parm(1).parameter_name := regexp_substr(sParmCheck,'\[[^\[]+\]',1,iOccurrence);*
    END LOOP;
    END LOOP;
    END LOOP;
    RETURN;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(li_exception,SUBSTR(SQLERRM,1,1000));
    RETURN;
    END template_parameters;
    This function is part of a package.
    The data on both environments is the same.

Maybe you are looking for