Sorry-duplicate thread,since problem in forumby5.45pm pl/sql region in apex

Hi All,
From sqlworkshop,
I have created a view like
CREATE OR REPLACE FORCE VIEW VW_SUB_CL_ADD1 AS
(select a.siteid siteid,a.bpaadd_0 bpaadd_0,a.bpanum_0 bpanum_0,
case when a.bpaaddlig_0 = '' then '-' else a.bpaaddlig_0 end address1,
case when a.bpaaddlig_1 = '' then '-' else a.bpaaddlig_1 end address2,
case when a.bpaaddlig_2 = '' then '-' else a.bpaaddlig_2 end address3,
case when a.bpades_0 = '' then '-' else a.bpades_0 end place,
case when a.cty_0 = '' then '-' else a.cty_0 end city,
case when a.poscod_0 = '' then '-' else a.poscod_0 end pincode,
case when b.cntnam_0 = '' then '-' else b.cntnam_0 end contactname,
case when b.fax_0 = '' then '-' else b.fax_0 end fax,
case when b.MOBTEL_0 = '' then '-' else b.MOBTEL_0 end mobile,
case when b.TEL_0 = '' then '-' else b.TEL_0 end phone,
case when b.web_0 = '' then '-' else b.web_0 end website,
c.zinvcty_0 zcity,c.bpainv_0 bpainv_0,c.bpcnum_0 bpcnum_0
from lbcreport.bpaddress@info a,lbcreport.contact@info b ,lbcreport.bpcustomer@info c
where (a.bpanum_0=b.bpanum_0) and (a.cty_0 = c.zinvcty_0) and (a.siteid = c.siteid))
but when i execute select * from vw_sub_cl_add1
the case is not working. '-' is not getting displayed for null values even i tried nvl function it is not working
when i use this view in apex for pl/sql region to display in the form of table .
The problem is, when there is no value in the columns the table is not showing row and column in a proper manner.
could any one help to overcome it.
Thanks in advance
bye
Srikavi
Edited by: srikavi on Sep 10, 2008 10:42 AM

Srikavi,
1. The problem with null values is a template problem. Using Firefox and Web Developer Toolbar extension / CSS / View Style Information, you can find out which css class your report is referencing. Open the corresponding css file and add the following to the css class:
empty-cells:show;border-collapse:collapse;
It will show the borders for null values after that.
2. b.fax_0 = '' is not correct. It should be b.fax_0 IS NULL.
3. You can also try to use the built in property for showing NULL values as in the report attributes.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
-------------------------------------------------------------------

Similar Messages

  • Duplicate Threads Being Created with iMessage for Mac

    I have iMessage installed on my Mac, iPhone and iPad and all are sync'd fine.
    I have everything set to send from my phone number but when replying to a group message (4 people all on iOS 6) from my mac it will create a duplicate thread. This only happens when I reply from my Mac though.
    Thanks,

    I looked through the preferences for TextEditor. I had "Delete the automatic backup file unchecked". I think checking this option will fix the problem.

  • Unable to Install Office 2013 Pro and I get returned message "Couldn't Install We're sorry, we had a problem installing your office programs"

    I purchased 40 licenses of Office 2013 Pro from a vendor in the US and received 40 product keys along with the URL to download the software - 1 for each pc activation codes.  I have done a few and were all successful.  I am now trying
    install on 2 other pcs and I am having real difficulty and getting error message each time I try to install.  I am able to download the installer and copied to my desktop and when I double click to execute it, it gives me the option to run on the next
    screen.  I click on run then it gives me the message " do you want to allow the program to make changes to this computer".  When I press YES, nothing happens and minutes later, I get the flwg message everytime, "Couldn't
    install"  "We're sorry, we had a problem installing your office programs.  Is your internet connection working?  Do you have enough free space on your main hard drive?  Please try installing again after you've checked the above. 
    Go online for additional help.
    I have lots of space and my pc is Win 7 64 bit new machine.  I have connection to internet and I was able to get the others done.  What is the problem here and I have been trying to work late night hours to try to install the program and I am unable
    to successfully get it to work.  I receive the same message every time and I followed all the recommended troubleshoot steps I found on the internet.  Someone please help.  I have to install all for all the PCs we have for our organization. 
    Please respond because I am really stuck.
    Gabe

    Hi Gabe,
    First, please check the suggestion above is helpful. I also suggest you removing all version of Office and re-install Office 2013.
    We can try to run the application as an administrator and check if it works.
     1. Right click the shortcut of the application or the main application.
     2. Select properties.
     3. Select compatibility tab and select "Run this program as an administrator."
    If there is anything I can do for you about this issue, don't hesitate to tell me.
    Best regards,
    Greta Ge
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Office Web Apps 2013 - Sorry, there was a problem and we can't open this document. If this happens again, try opening the document in Microsoft Word

    Hello
    I had configured Office Web Apps for SharePoint 2013 which was working fine for about 2 months until this morning.
    The error message I get for WORD, PDF and Excel files is:
    The ULS logs on the WFE give me this:
    WOPI (CheckFile) Proof Data: AccessToken Hash '1572676699' [1054 bytes], URL
    01/08/2014 11:01:58.01*    w3wp.exe (0x1368)                           0x09B4    SharePoint Foundation       
         WOPI                              afk59    Monitorable   
    WOPI                              agxqc    Medium      WOPI Signature verification
    attempt failed with public key 01/08/2014
    11:01:58.01     w3wp.exe (0x1368)                           0x09B4    SharePoint Foundation       
         WOPI                              agxqc    Medium      WOPI
    Signature verification attempt failed with public key
    01/08/2014 11:01:58.01     w3wp.exe (0x1368)                           0x09B4    SharePoint Foundation       
         WOPI                              agxqb    Medium      WOPI
    Signature verification attempt failed - no public key    e75ead18-af27-4d44-ba50-b38b408011e8
    01/08/2014 11:01:58.01     w3wp.exe (0x1368)                           0x09B4    SharePoint Foundation       
         WOPI                              ahdzz    Monitorable    WOPI
    Proof: All WOPI Signature verification attempts failed    e75ead18-af27-4d44-ba50-b38b408011e8
    01/08/2014 11:01:58.01     w3wp.exe (0x1368)                           0x09B4    SharePoint Foundation       
         WOPI                              ag7pj    Unexpected    WOPI
    (CheckFile) - Invalid Proof Signature for file Letterhead Template.docx  url: http://site.contoso.com/_vti_bin/wopi.ashx/files/9c5d0d7077aa43e9a9538c02deb57580?access_token=eyJ0eXAiOiJKV1QiLCJhbGciOi
    The ULS Logs on my Office Web Apps server gives me this:
    Error message from host: Verifying signature failed, host correlation:     d197d187-ef9d-42f6-ae4f-c4b8199c1078
    WOPICheckFile,WACSERVER FileNotFound
    WOPI CheckFile: Catch-All Failure [exception:Microsoft.Office.Web.Common.EnvironmentAdapters.FileUnknownException: WOPI 404
    Any idea what may have caused this issue all of a sudden?
    Thank you.
    Yoshi

    Hi Waqas
    Thanks for your help with this. I had a look at both posts, the URL works fine from the WAC server and I am not using a System account to test docs.
    Also, this is a production site that is accessible over the Internet, so we are using https therefore the WOPIZone is external-https.
    Issue #3 in the above blog link does not reflect the same error I see on my servers.
    I also had a look at the information in this link: http://technet.microsoft.com/en-us/library/ff431687.aspx#oauth
    Problem: You receive a "Sorry, there was a problem and we can't open this document" error when you try to view an Office document in Office Web Apps.
    If you added domains to the Allow List by using the
    New-OfficeWebAppsHost cmdlet, make sure you’re accessing Office Web Apps from a host domain that’s in the Allow List. To view the host domains in the Allow List, on the Office Web Apps Server open the Windows PowerShell prompt as an administrator and run
    the Get-OfficeWebAppsHost cmdlet. To add a domain to the Allow List, use the
    New-OfficeWebAppsHost cmdlet.
    I have not added any domains to the Allow list so this did not help either. Should I add the domain?
    Any further help with this is much appreciated.
    Thanks again.
    Yoshi

  • I am getting error when hovering on document in sharepoint online "sorry there was a problem and we can't open this document.If this happens again, try opening the document in Microsoft Word"

     I am getting error when hovering on document in sharepoint online "sorry there was a problem and we can't open this document.If this happens again, try opening the document in Microsoft Word".I am sure that document is not corrupted and
    all. something it showing the preview and sometimes it throwing this error. I hope this error is intermident. When clicking on the link also it throws this error but on refreshing it working fine. I dont know why it is happening. Please helpme  to resolve
    this issue. 

    Hi Waqas
    Thanks for your help with this. I had a look at both posts, the URL works fine from the WAC server and I am not using a System account to test docs.
    Also, this is a production site that is accessible over the Internet, so we are using https therefore the WOPIZone is external-https.
    Issue #3 in the above blog link does not reflect the same error I see on my servers.
    I also had a look at the information in this link: http://technet.microsoft.com/en-us/library/ff431687.aspx#oauth
    Problem: You receive a "Sorry, there was a problem and we can't open this document" error when you try to view an Office document in Office Web Apps.
    If you added domains to the Allow List by using the
    New-OfficeWebAppsHost cmdlet, make sure you’re accessing Office Web Apps from a host domain that’s in the Allow List. To view the host domains in the Allow List, on the Office Web Apps Server open the Windows PowerShell prompt as an administrator and run
    the Get-OfficeWebAppsHost cmdlet. To add a domain to the Allow List, use the
    New-OfficeWebAppsHost cmdlet.
    I have not added any domains to the Allow list so this did not help either. Should I add the domain?
    Any further help with this is much appreciated.
    Thanks again.
    Yoshi

  • Issue with office web apps sorry, there was a problem and we can't open this document.

    Hi All,
    i am having issue when trying to open the word file using office web apps farm. i have multi-tier farm (2 wfe, 2 apps and 2 owa). is that something wrong with certificate or the way AAM configured. Can anyone give me some direction please?

    Hi,
    According to your description, my understanding is that you failed to open the word file using office web app.
    Please open the word file using office web app in other SharePoint sites and test whether this issue occurs. Also, please test whether all words have this issue.
    Please reset IIS on the OWA server.
    Please disconnect the SharePoint Farm from Office Web Apps and reconnect it. Then check the WOPIZone and TMG server.
    Please created certificate for your PC and update mappings of IP addresses.
    Some useful posts for your reference:
    https://social.technet.microsoft.com/Forums/office/en-US/fdbf2198-5a62-422a-9015-a65599eabeb5/office-web-apps-2013-sorry-there-was-a-problem-and-we-cant-open-this-document-if-this-happens?forum=sharepointadmin
    https://social.technet.microsoft.com/Forums/office/en-US/154e9673-8227-4913-9f2a-97677e4c5314/sorry-there-was-a-problem-and-we-cant-open-that-document?forum=sharepointadminprevious
    http://sharepoint.stackexchange.com/questions/66013/a-problem-with-a-websites-security-certificate-for-apps
    Best Regards,
    Dean Wang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • I can get the signed to Hotmail but I can not read my mail. Sorry, there's a problem with Hotmail right now Hotmail wasn't able to complete this request. Microsoft may contact you about any issues you report.

    about 10 days ago started having trouble with Hotmail. Could isgn in but keep getting the following message.
    Sorry, there's a problem with Hotmail right now
    Hotmail wasn't able to complete this request. Microsoft may contact you about any issues you report.
    I can send mail and review my contacts but that is it.
    I then tried getting in with Internet Explorer and it works fine. I do not like IE because I have problems with some websites.

    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    *Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode

  • All my photo libraries in my iPhone have duplicate photos since I have installed IOS 6.  Please help.

    All my photo libraries in my iPhone have duplicate photos since I have installed IOS 6. I work with Aperture 3.3 not iPhoto! Also, most of the photos in my camera library have been deleted without my consent! I'm very ****** about that! Please help.

    Photos in Photo Library are the ones that you've synced from your iTunes to your iPad. To free up space, you should delete these photos on your Photo Library since you already have the copies on your computer: Connect your iPad with your computer > Launch iTunes > click your iPad and navigate to Photos window > check Sync Photos from > select an empty folder and click Apply to carry out the syncing. After then, all photos in your Photo Library will be deleted.
    As for photos in Camera Roll on your iPad, you should copy them to your computer for backup and deleted the copies on your iPad:Import photos and videos from your iPhone, iPad, or iPod touch to your Mac or Windows PC - Apple Support

  • Sorry there was a problem checking your details.

    Hi,
    When I go to run the broadband speed test on the BT website it says. Thought it was the website at first as it started doing this the other day.
    Sorry there was a problem checking your details. Please check you have entered the correct telephone number and then press 'Start Test' again.
    Then this:
    Sorry, but we've not been able to match all of your details
    You can continue and run our download speed test now, but please note that we will only be able to offer you a limited assessment on the meaning of your results.
    Yet it will let me continue and do the test anyway. Any Ideas?
    Thanks

    FAQ
    1. Best Effort Test: -provides background information.
    Download Speed
    55.44 Mbps
    0 Mbps
    57.38 Mbps
    Max Achievable Speed
     Download speedachieved during the test was - 55.44 Mbps
     For your connection, the acceptable range of speedsis 45.9 Mbps-57.38 Mbps .
     Additional Information:
     IP Profile for your line is - 57.38 Mbps
    2. Upstream Test: -provides background information.
    Upload Speed
    8.5 Mbps
    0 Mbps
    20 Mbps
    Max Achievable Speed
    Upload speed achieved during the test was - 8.5Mbps
     Additional Information:
     Upstream Rate IP profile on your line is - 20 Mbps
    We were unable to identify any performance problem with your service at this time.
    It is possible that any problem you are currently, or had previously experienced may have been caused by traffic congestion on the Internet or by the server you were accessing responding slowly.
    If you continue to encounter a problem with a specific server, please contact the administrator of that server in the first instance. 
    Please visit the FAQ if you are unable to understand the test results.

  • Facing duplicate button press problem.

    Hi,
    I am a beginner to JSF technology. I am working on a project that uses JSF 1.1 specification. I am facing "*duplicate button press problem*". Most of the links and submit buttons do not respond. With a lot of search I found that this problem was fixed in JSF 1.2.
    I want to know whether upgrading to JSF 1.2 will work or not ? Also will it require code changes in existing code or simply upgrade will do?
    - Sax

    I'm not sure why you are focused on 1.1 vs 1.2 on this issue. For both versions you need the POST-REDIRECT-GET pattern, facilitated by the <redirect/> directive in the navigation rules.

  • MSI VOX Audio / Video Sinc problem

    Hi All.
    Last week i bought a VOX TV Tuner.  Nice device works well except for what i want it for.
    When I try to cpature at Full PAL DVD resolution I get audio / video sinc problems.  The audio is usually ahead of the video.  Half PAL DVD or below  it's fine.
    I suspect it is the basic design of the box that is the trouble.  Having the audio feed to the sound card rather than than in the USB2 feed has been a no no ever since the problem was discovered back in the USB 1 days.  USB2 is capable of 400Megbits..  
    However I contacted another user who has no problems and says there is a patch for Direct x PAL video capture.  Does any one know of this patch or has any one had the same problem as I have??
    This device seems so new that there is no info on the net about it..
    TIA.
    System :  P4. 2.4 Gig, 512 Meg ram, fast HDs, Direct X 9.0 (have not installed 9.0b yet) Asus Mobo P4Pe.  Matrox Mystique video card. Win 2K SP4

    Quote
    However I contacted another user who has no problems and says there is a patch for Direct x PAL video capture
    I would chase that up as it sounds promising.

  • Duplicate thread: Maximum no. of attributes on a Characteristics.

    <duplicate thread>
    Please ignore this.
    Edited by: Saurabh Bansal on Sep 25, 2009 5:54 PM

    Hi Sauarbh,
    In theory, the limit should be equal to the max no. of fields in the table (in this case 749).
    However, you must then consider the type of attributes the InfoObject has (time-dependent, time-independent, navigational).
    Time-Dependent Example
    749
    - 1       (for the Infoobject itself)
    - X       (for number of compoundings)
    - 2       (for DATE_FROM and DATE_TO)
    - 1       (field OBJVERS)
    - 1       (field CHANGED)
    - Y        (for the number of time dep. Attrs)
    744 - X - Y
    The minimum an IOBJ can have is as below and based on this, the acceptable amount of IOBJ attrs is calculated dynamically by considering what attributes exists for that particular object
    3  P table       (object itself, OBJVERS, CHANGED)
    5  Q table     (object itself, 2X time dep, OBJVERS, CHANGED)
    4  X table.      (object itself, OBJVERS, CHANGED)
    6  Y table.      (SID,object itself,2X time dep,OBJVERS,CHANGED)
    Best Regards,
    Vincent

  • Re: Problem providing download link for BLOB data in apex report

    Hi Don,
    Your solution below worked but in the download option i only see save but not open for PDf file in the blob. Please let me know if you have any suggestion to achieve it
    Thanks
    Jo
    Problem providing download link for BLOB data in apex report 
    591953 Nov 19, 2008 1:55 PM (in response to 660436)
    Currently Being Moderated
    Good morning,
    Here is how I have solved this problem.
    1. The select statement in the sql for the report should not include the BLOB column. I decided to select only 2 columns, the column that has the key and the column with the filename.
    2. On the first column ( the primary key ) I put in the format statement that was simply DOWNLOAD:TABLENAME:BLOB_COLUMN:PRIMARY_KEY
    This works. I believe that the Oracle error I was getting was because I was trying to apply this format statement to the actual BLOB column.
    So, it appears that you can use any of the columns in the report to hold the DOWNLOAD format statement since in the format statement, you are defining the BLOB table, BLOB column and the primary key into that column.
    Hope this helps,
    Don.

    Branched out from a years old thread.
    user3003326 Don't post to old threads, please.

  • Can some one please tell me what is the problem in the below pl/sql block

    Hi, I have problem with the following pl/sql block, I need this with bulk operation.
    -- Assume the following scenario, we are validating dept (master) and emp(child) which are my temporary tables and updating the status back to
    -- dept ( for all the validation errors, even if we have any validation at child  it has to update the header record with error message),
    -- upon successful validation insert the data into dept3, and emp3 interms of batches
    -- I have give the sample example with dept and emp, but i have around 10 million records which has around 30-40 validations,
    -- I would like to process them in terms of batches using bulk collection as this would do fast processing
    -- Can some one please tell me how to insert them in terms of bulk with every set of 1000 records in each batch in this example,for every set of 1000 records
    -- i need update batch id with unique number in dept table
    -- with current data i can have 50 batches , I need to pass, deptno as parameter to my emp cursor. 
    -- can some one please tell me how to make this validation and insertion more efficient. so that while inserting the data for every batch it should insert batch id
    -- Tried with LIMIT clause as well but not working
    -- I am correcting the code as per your comments Request you to please suggest me so that I can correct , I am new to PL/sql, started learning now.
    step - 1:
    CREATE TABLE DEPT
           (DEPTNO NUMBER(6) primary key,
            DNAME VARCHAR2(25),
            LOC VARCHAR2(23),
            batch_id number );
    INSERT INTO DEPT VALUES (10, 'ACCOUNTING', 'NEW YORK', null);
    INSERT INTO DEPT VALUES (20, 'RESEARCH',   'DALLAS', null);
    INSERT INTO DEPT VALUES (30, 'SALES',      'CHICAGO', null);
    INSERT INTO DEPT VALUES (40, 'OPERATIONS', 'BOSTON', null);
    step - 2:
    declare
    begin
    for i in 1..50000 loop
    insert into dept values(40+i, 'OPERATIONS'||i,'BOSTON'||i, null);
    end loop;
    commit;
    exception
    when others then
    dbms_output.put_line('Exception occured:'||SQLERRM);
    end;
    step - 3:
    create sequence emp_seq start with 1 increment by 1;
    step - 4:
    CREATE TABLE EMP
           (EMPNO NUMBER(15) NOT NULL primary key,
            ENAME VARCHAR2(20),
            JOB VARCHAR2(20),
            MGR NUMBER(4),
            HIREDATE DATE,
            SAL NUMBER(7, 2),
            COMM NUMBER(7, 2),
            DEPTNO NUMBER(6));
    INSERT INTO EMP VALUES
            (7369, 'SMITH',  'CLERK',     7902,
            TO_DATE('17-DEC-1980', 'DD-MON-YYYY'),  800, NULL, 20);
    INSERT INTO EMP VALUES
            (7499, 'ALLEN',  'SALESMAN',  7698,
            TO_DATE('20-FEB-1981', 'DD-MON-YYYY'), 1600,  300, 30);
    INSERT INTO EMP VALUES
            (7521, 'WARD',   'SALESMAN',  7698,
            TO_DATE('22-FEB-1981', 'DD-MON-YYYY'), 1250,  500, 30);
    INSERT INTO EMP VALUES
            (7566, 'JONES',  'MANAGER',   7839,
            TO_DATE('2-APR-1981', 'DD-MON-YYYY'),  2975, NULL, 20);
    INSERT INTO EMP VALUES
            (7654, 'MARTIN', 'SALESMAN',  7698,
            TO_DATE('28-SEP-1981', 'DD-MON-YYYY'), 1250, 1400, 30);
    INSERT INTO EMP VALUES
            (7698, 'BLAKE',  'MANAGER',   7839,
            TO_DATE('1-MAY-1981', 'DD-MON-YYYY'),  2850, NULL, 30);
    INSERT INTO EMP VALUES
            (7782, 'CLARK',  'MANAGER',   7839,
            TO_DATE('9-JUN-1981', 'DD-MON-YYYY'),  2450, NULL, 10);
    INSERT INTO EMP VALUES
            (7788, 'SCOTT',  'ANALYST',   7566,
            TO_DATE('09-DEC-1982', 'DD-MON-YYYY'), 3000, NULL, 20);
    INSERT INTO EMP VALUES
            (7839, 'KING',   'PRESIDENT', NULL,
            TO_DATE('17-NOV-1981', 'DD-MON-YYYY'), 5000, NULL, 10);
    INSERT INTO EMP VALUES
            (7844, 'TURNER', 'SALESMAN',  7698,
            TO_DATE('8-SEP-1981', 'DD-MON-YYYY'),  1500, NULL, 30);
    INSERT INTO EMP VALUES
            (7876, 'ADAMS',  'CLERK',     7788,
            TO_DATE('12-JAN-1983', 'DD-MON-YYYY'), 1100, NULL, 20);
    INSERT INTO EMP VALUES
            (7900, 'JAMES',  'CLERK',     7698,
            TO_DATE('3-DEC-1981', 'DD-MON-YYYY'),   950, NULL, 30);
    INSERT INTO EMP VALUES
            (7902, 'FORD',   'ANALYST',   7566,
            TO_DATE('3-DEC-1981', 'DD-MON-YYYY'),  3000, NULL, 20);
    INSERT INTO EMP VALUES
            (7934, 'MILLER', 'CLERK',     7782,
            TO_DATE('23-JAN-1982', 'DD-MON-YYYY'), 1300, NULL, 10);
    commit;
    step :- 5
    declare
    cursor c1 is select * from dept;
    k number:=0;
    m number:=0;
    begin
    for i in  c1 loop
    k:=k+1;
    --dbms_output.put_line('k:'||k);
    --dbms_output.put_line('i.deptno:'||i.deptno);
    m:=0;
    for j in 1..5 loop
    m:=m+1;
    --dbms_output.put_line('m:'||m);
    --dbms_output.put_line('i.deptno:'||i.deptno);
    insert into emp values
            (9000+emp_seq.nextval, 'SMITH'||'_'||emp_seq.currval,  'CLERK'||'_'||emp_seq.currval,     7902,
            TO_DATE('17-DEC-1980', 'DD-MON-YYYY'),  800, NULL, i.deptno);
    end loop;
    end loop;
    commit;
    exception
    when others then
    dbms_output.put_line('Exception occured:'||sqlerrm);
    end;
    step :-6
    create table dept3 as select * from dept where 1=2;
    create table emp3 as select * from emp where 1=2;
    alter table dept add object_id number;
    alter table dept add status varchar(20);
    alter table dept add err_msg varchar2(200);
    alter table emp add object_id number;
    -- I have not included the alter statements in the inital creation because i dont want them to insert into dept3 and emp3
    CREATE OR REPLACE
    PACKAGE test_b
    AS
      g_batch_id NUMBER;
      PROCEDURE emp_ins(
          p_EMPNO    NUMBER,
          p_ENAME    VARCHAR2,
          p_JOB      VARCHAR2,
          p_MGR      NUMBER,
          p_HIREDATE DATE,
          p_SAL      NUMBER,
          p_COMM     NUMBER,
          p_DEPTNO   NUMBER);
      PROCEDURE dept_ins(
          p_DEPTNO NUMBER,
          p_dname  VARCHAR2 ,
          p_LOC    VARCHAR2,
          p_batch  NUMBER);
      PROCEDURE validate_prc;
      PROCEDURE main;
    TYPE dept_t
    IS
      TABLE OF dept%ROWTYPE;
      hdr_tbl dept_t;
    TYPE emp_t
    IS
      TABLE OF emp%ROWTYPE;
      line_tbl emp_t;
    TYPE dept_i_t
    IS
      TABLE OF dept3%ROWTYPE;
      hdr_ins_tbl dept_i_t;
    TYPE emp_i_t
    IS
      TABLE OF emp3%ROWTYPE;
      line_ins_tbl emp_i_t;
    END;
    -- pacakge body
    CREATE OR REPLACE
    PACKAGE body test_b
    AS
    PROCEDURE emp_ins(
        p_EMPNO    NUMBER,
        p_ENAME    VARCHAR2,
        p_JOB      VARCHAR2,
        p_MGR      NUMBER,
        p_HIREDATE DATE,
        p_SAL      NUMBER,
        p_COMM     NUMBER,
        p_DEPTNO   NUMBER)
    IS
    BEGIN
      INSERT
      INTO EMP3
          EMPNO ,
          ENAME ,
          JOB ,
          MGR ,
          HIREDATE ,
          SAL ,
          COMM ,
          DEPTNO
        VALUES
          P_EMPNO ,
          P_ENAME ,
          P_JOB ,
          P_MGR ,
          P_HIREDATE ,
          P_SAL ,
          P_COMM ,
          P_DEPTNO
    EXCEPTION
    WHEN OTHERS THEN
      DBMS_OUTPUT.PUT_LINE('EXCEPTION AT EMP INSERT'||SQLERRM);
    END;
    PROCEDURE dept_ins
        p_DEPTNO NUMBER,
        p_dname  VARCHAR2 ,
        p_LOC    VARCHAR2,
        p_batch  NUMBER
    IS
    BEGIN
      INSERT
      INTO DEPT3
          DEPTNO ,
          DNAME ,
          LOC ,
          batch_id
        VALUES
          p_DEPTNO ,
          p_DNAME ,
          p_LOC ,
          p_batch
    EXCEPTION
    WHEN OTHERS THEN
      DBMS_OUTPUT.PUT_LINE('EXCEPTION AT DEPT INSERT'||SQLERRM);
    END ;
    PROCEDURE validate_prc
    IS
      CURSOR c1
      IS
        SELECT * FROM dept WHERE status IS NULL ;--AND rownum <25;
      CURSOR c2(p_dept NUMBER )
      IS
        SELECT * FROM emp WHERE deptno=p_dept;
      e_validation EXCEPTION;
    BEGIN
      OPEN c1;
      LOOP
        FETCH c1 BULK COLLECT INTO hdr_tbl limit 5000;
        SELECT emp_seq.nextval INTO g_batch_id FROM dual;
        EXIT
      WHEN hdr_tbl.count = 0;
        dbms_output.put_line('batch'||g_batch_id);
      END LOOP;
      CLOSE c1;
      dbms_output.put_line('C1 closed');
      --------- Loading data into the inv line table type -------------------------------
      FOR i IN 1 .. hdr_tbl.count
      LOOP
        dbms_output.put_line('started validation');
        -- do header level validations
        IF hdr_tbl(i).dname  IS NULL THEN
          hdr_tbl(i).status  := 'ERROR';
          hdr_tbl(i).err_msg :=',DNAME is null';
        END IF;
        OPEN c2(hdr_tbl(i).deptno);
        LOOP
          FETCH c2 BULK COLLECT INTO line_tbl;
          -- EXIT WHEN c2%NOTFOUND;
        END LOOP;
        CLOSE c2;
        FOR j IN 1 .. line_tbl.count
        LOOP
          -- do line validations
          IF line_tbl(j).ename IS NULL THEN
            hdr_tbl(i).status  := 'ERROR';
            hdr_tbl(i).err_msg :=',ENAME is null';
          END IF;
          BEGIN
            FORALL j IN line_tbl.FIRST .. line_tbl.LAST
            SAVE EXCEPTIONS
            UPDATE EMP
            SET object_id =3
              -- I have multiple columns to update based on validations
            WHERE deptno =hdr_tbl(i).deptno------------
            AND empno    =line_tbl (j).empno;
            COMMIT;
            line_tbl.DELETE;
            dbms_output.put_line( 'Successfully updated emp temp table.');
          EXCEPTION
          WHEN OTHERS THEN
            ROLLBACK;
            dbms_output.put_line( 'Error while updating line temp table. ' || sqlerrm );
            FOR j IN 1 .. sql%BULK_EXCEPTIONS.COUNT
            LOOP
              DBMS_OUTPUT.put_line(' occurred during line temp table updation ' || sql%BULK_EXCEPTIONS(i).ERROR_INDEX );
            END LOOP;
            raise e_validation;
          END;
        END LOOP; -- j
        --CLOSE c2;
        IF hdr_tbl(i).err_msg IS NULL THEN
          hdr_tbl (i).status  := 'VALID';
          hdr_tbl (i).err_msg := NULL;
        END IF;
        -- even if I have line validation failed I have to update header status and erorr msg
        BEGIN
          FORALL i IN hdr_tbl.FIRST .. hdr_tbl.LAST
          SAVE EXCEPTIONS
          UPDATE DEPT
          SET object_id =4,
            status      = hdr_tbl (i).status,
            err_msg     = hdr_tbl (i).err_msg
            --  batch_id =
            -- I have multiple columns to update based on validations
          WHERE deptno = hdr_tbl (i).deptno
          AND status  IS NULL; ------------
          COMMIT;
          hdr_tbl.DELETE;
          dbms_output.put_line( 'Successfully updated dept temp table.');
          --close c1;
        EXCEPTION
        WHEN OTHERS THEN
          ROLLBACK;
          dbms_output.put_line( 'Error while updating hdr temp table. ' || sqlerrm );
          FOR i IN 1 .. sql%BULK_EXCEPTIONS.COUNT
          LOOP
            DBMS_OUTPUT.put_line(' occurred during line temp table updation ' || sql%BULK_EXCEPTIONS(i).ERROR_INDEX );
          END LOOP;
          raise e_validation;
        END;
      END LOOP; --i
    EXCEPTION
    WHEN OTHERS THEN
      DBMS_OUTPUT.PUT_LINE('EXCEPTION AT validate'||SQLERRM);
    END ;
    PROCEDURE main
    IS
      CURSOR dept_ins_cur
      IS
        SELECT * FROM dept WHERE status='VALID';
      CURSOR emp_ins_cur(p_deptno NUMBER)
      IS
        SELECT * FROM emp WHERE deptno= p_deptno;
    BEGIN
      validate_prc;
      OPEN dept_ins_cur;
      LOOP
      FETCH dept_ins_cur BULK COLLECT INTO hdr_ins_tbl limit 1000
      EXIT
      WHEN dept_ins_cur%NOTFOUND;
      END LOOP;
      CLOSE dept_ins_cur;
      --------- Loading data into the inv line table type -------------------------------
      FOR i IN 1 .. hdr_tbl.count
      loop
      dept_ins(hdr_ins_tbl(i).deptno ,
      hdr_ins_tbl(i).DNAME ,
      hdr_ins_tbl(i).LOC , emp_seq.nextval);
      commit;
      OPEN emp_ins_cur(hdr_ins_tbl(i).deptno);
      LOOP
      FETCH emp_ins_cur BULK COLLECT INTO line_ins_tbl;
      --EXIT WHEN emp_ins_cur%NOTFOUND;
      END LOOP;
      CLOSE emp_ins_cur;
      for j in 1..line_ins_tbl.count loop
      emp_ins(line_ins_tbl(j).EMPNO ,
      line_ins_tbl(j).ENAME ,
      line_ins_tbl(j).JOB ,
      line_ins_tbl(j).MGR ,
      line_ins_tbl(j).HIREDATE ,
      line_ins_tbl(j).SAL ,
      line_ins_tbl(j).comm ,
      line_ins_tbl(j).DEPTNO );
      end loop;
      end loop;
      commit;
      BEGIN
      forall i IN hdr_ins_tbl.first .. hdr_ins_tbl.last
      SAVE exceptions
      UPDATE dept
      SET status   = 'INSERTED',
      err_msg  = null
      WHERE deptno=hdr_ins_tbl (i).deptno
      AND status   = 'VALID';
      COMMIT;
      hdr_ins_tbl.delete;
      dbms_output.put_line( 'inserting into temp tables.');
      EXCEPTION
      WHEN OTHERS THEN
      rollback;
      end;
    EXCEPTION
    WHEN OTHERS THEN
      dbms_output.put_line('exception in main' ||SQLERRM);
    END ;
    END;
    Thanks in advance...
    Message was edited by: 888025

    Hi, I have problem with the following pl/sql block
    Well, as Hoek already said, that is the understatement of the century.
    I can't be absolutely certain but I think that set of DDL and code that you posted has just about every possible error and design issue that there is! It would make an excellent addition to BluShadow's FAQs an an example of what NOT to do.
    I don't think it is even possible to 'fix the basics first' as Hoek suggested. IMHO the first step needs to be to create a functional requirements document (FRD) that explains in detail WHAT needs to be done. That doc should also contain info about how any errors/recovery/restart is to be handled. It is premature to try to implement ANY solution without first knowing what is needed functionally.
    Once the FRD is done you should do a walk-through based on your current architecture and sample data to make sure that the document really covers ALL of the steps that need to be performed and that it adequately explains how to deal with any processing or data issues that might arise.
    The next document you need is the TRD - Technical Requirements Doc that covers the different technical implementions of the FRD that can be done and the advantages/disadvantages of each.
    Then you can start working on a prototype.
    1. The DDL you posted isn't coherent - there are CREATE table statements and then later ALTER statements that add additional columns. There doesn't appear to be any reason for not including ALL of the columns in the CREATE table statement.
    2. You are using PL/SQL types instead of SQL types. That makes it impossible to use those types in SQL statements and makes it much more difficult to test since it is much easier to test a query in SQL (e.g. using sql*plus) that to embed the query in PL/SQL.
    3. You are defining the same type twice but giving it different names.
    TYPE dept_t
       IS
          TABLE OF dept%ROWTYPE
             INDEX BY binary_integer;
    TYPE dept_i_t
       IS
          TABLE OF dept%ROWTYPE
             INDEX BY binary_integer;
    Those are both based on the same DEPT table! Why the duplication?
    Also you are using associative arrays instead of just using nested tables. Get rid of the INDEX BY clause.
    4. You have some serious architectural and data model issues
    -- Assume the following scenario, we are validating dept (master) and emp(child) which are my temporary tables and updating the status back to
    -- dept ( for all the validation errors, even if we have any validation at child  it has to update the header record with error message),
    Why would you do that? You say 'it has to update the header record ...'. Says who? That is just one indication that you are trying to implement a 'solution' before you have adequately defined the 'problem'.
    Typically you would NOT alter any of the data tables; any validation errors/issues would get inserted into a table specifically designed to hold/log those issues. That table would contain key field values to correlate with the source of the error.
    Those 'master' and 'child' entities are two SEPARATE things. Issues with a 'master' row have NOTHING to do with any possible child rows.
    And issues with a 'child' row have NOTHING to do with any possible master rows. The ONLY connection between 'child' and 'master' is the foreign key that correlates them.
    So you don't necessarily have to validate the 'child' rows in sync with their 'master' row. In many cases you would have a procedure that performs validation of the entire set of 'master' rows and log those issues/problems. You would use a different procedure to validate the entire set of 'child' rows and log their issues.
    Those validation procedures can often work with ALL of the data using SQL statements instead of bulk processing.
    5. You are using loop constructs that are not valid for the type of processing you are using
    LOOP
        FETCH c1 BULK COLLECT INTO hdr_tbl;
        EXIT
      WHEN c1%NOTFOUND;
      END LOOP;
    There can be NO exit since the bulk collect with either get EVERYTHING or NOTHING. Possibly that is just a holdover from your attempt to use the LIMIT clause but you removed that clause from the FETCH; I don't know.
    There is so much wrong with what you posted it is really rather pointless to try to 'fix' it.
    I suggest you start over and clarify and DOCUMENT the actual requirements without prejudice about the solution that someone seems to want to force on you.

  • Problem returning variables from dynamic SQL/PLSQL

    Hi, I have a problem I am trying to solve using a very short piece of dynamic SQL or PLSQL but I am having problems getting the variable values out of the dynamic block.
    I have 16 counters whose names are made up of three variable parts - 'scheme', 'contributory category' and 'employment category'
    The 'scheme' can be either 'no1', 'no2', 'off', 'cg' or 'amc'
    The 'contributory category' can be either 'cont' or 'noncont'
    The 'employment category' can be either 'ft' or 'pt'
    (There are only 16 because only 16 combinations are possible)
    For example the total counter name could be 'v_cg_noncont_ft_count'
    I have created a variable by concatenating the various elements called v_incr_count_name which holds the name of the counter I want to increment.
    I am running this whole thing within an anonymous PLSQL block so I cannot use global variables meaning that my variables are not visible within a dynamic PLSQL block.
    I believe this means that either I need to bind the variables within a PLSQL block or use a SELECT FROM INTO SQL block.
    I have tried a few solutions with no luck such as the following PLSQL:
    v_incr_count := 'v_'||v_scheme||'_'||v_cont_cat||'_'||v_emp_cat||'_count';
    sql_stmt := 'BEGIN :a := :a + 1; END;';
    EXECUTE IMMEDIATE sql_stmt USING v_incr_count_name;
    Unfortunately I am getting the 'IN bind variable bound to an OUT position' error which I believe is because it is trying to return a value into v_incr_count_name which has been defined by default as an IN variable. The problem is that I need to store the returned value into the variable whose name is stored in v_incr_count_name.
    Another solution I tried is:
    v_incr_count_name := 'v_'||v_scheme||'_'||v_cont_cat||'_'||v_emp_cat||'_count';
    sql_stmt := 'SELECT '||v_incr_count_name||' + 1 FROM DUAL';
    EXECUTE IMMEDIATE sql_stmt INTO v_return;
    This solution gives me an 'Invalid colum error'
    Any help would be greatly appreciated
    Cheers, Dan

    Repost:
    Problem with variables in dynamic SQL/PLSQL

Maybe you are looking for