Nested table frees the file after validation?

Hello world

My version of DB is

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi

PL/SQL Release 10.2.0.1.0 - Production

"CORE 10.2.0.1.0 Production."

AMT for Linux: Version 10.2.0.1.0 - Production

NLSRTL Version 10.2.0.1.0 - Production

I have a question about the nested table. I am writing a code to change the data type for a column varchar2 to date without deleting the data.

So I thought instead of creating the table or the TWG, I will fill these data in the collection and updating of this column as null. So I'll change the data type for this column and the data that is loaded inside the collection, I'll shoot back as it is.

The collection is formed, the data are updated with the null value and data type of the column is updated as well. But when I'm trying to load the data in collection, it seems to be empty. Why is happening. ? Nested table depends on the statement commit?

Please take a look at the code and suggest me something here.

DECLARE

TYPE ARRAY_REC_TYPE IS RECORD (SPECTRA_MRN CROWN_WEB_PATIENT_LIST. TYPE % SPECTRA_MRN

CALENDAR_MONTH_END_DATE CROWN_WEB_PATIENT_LIST. TYPE % CALENDAR_MONTH_END_DATE

INFLUENZAWHENGIVEN CROWN_WEB_PATIENT_LIST. INFLUENZAWHENGIVEN % TYPE);

TYPE ARRAY_TAB_TYPE IS TABLE OF THE ARRAY_REC_TYPE;

VC_ARRAY_TAB_TYPE ARRAY_TAB_TYPE: = ARRAY_TAB_TYPE();

BEGIN

SELECT SPECTRA_MRN,

CALENDAR_MONTH_END_DATE,

INFLUENZAWHENGIVEN

BULK COLLECT INTO VC_ARRAY_TAB_TYPE

OF CROWN_WEB_PATIENT_LIST

WHERE INFLUENZAWHENGIVEN IS NOT NULL;

FOR I IN VC_ARRAY_TAB_TYPE.first... VC_ARRAY_TAB_TYPE. Last LOOP

UPDATE CROWN_WEB_PATIENT_LIST

SET INFLUENZAWHENGIVEN = NOTHING

WHERE SPECTRA_MRN = VC_ARRAY_TAB_TYPE (I). SPECTRA_MRN

AND TRUNC (CALENDAR_MONTH_END_DATE) = TRUNC (VC_ARRAY_TAB_TYPE (I). CALENDAR_MONTH_END_DATE);

END LOOP;

RUN IMMEDIATELY 'ALTER TABLE CROWN_WEB_PATIENT_LIST CHANGE INFLUENZAWHENGIVEN DATE ";

FOR K IN VC_ARRAY_TAB_TYPE.first... VC_ARRAY_TAB_TYPE. Last LOOP

UPDATE CROWN_WEB_PATIENT_LIST

SET INFLUENZAWHENGIVEN = TO_DATE (to_char (VC_ARRAY_TAB_TYPE (K). INFLUENZAWHENGIVEN, 'YYYY-MM-DD'))

WHERE SPECTRA_MRN = VC_ARRAY_TAB_TYPE (K). SPECTRA_MRN

AND TRUNC (CALENDAR_MONTH_END_DATE) = TRUNC (VC_ARRAY_TAB_TYPE (K). CALENDAR_MONTH_END_DATE);

END LOOP;

EXCEPTION

WHILE OTHERS THEN

ROLLBACK;

END;

/

Kind regards

BS2012.

Your EXCEPTION WHILE others removes any possible EXCEPTOIN that is raised. You need to get rid of him. Or at least use RAISES at the end. And if you decide to use the collection then get the best out of him using treatment in BULK. Here is an example FORALL.

SQL> desc t
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ID                                                 NUMBER
 DT                                                 VARCHAR2(10)

SQL> select * from t;

        ID DT
---------- ----------
         1 05-08-2014
         2 06-08-2014
         3 07-08-2014
         4 08-08-2014
         5 09-08-2014
         6 10-08-2014
         7 11-08-2014
         8 12-08-2014
         9 13-08-2014
        10 14-08-2014

10 rows selected.

SQL> declare
  2    type id_tbl is table of t.id%type;
  3    type dt_tbl is table of t.dt%type;
  4    l_id id_tbl;
  5    l_dt dt_tbl;
  6  begin
  7    select id, dt bulk collect into l_id, l_dt
  8      from t;
  9
 10    update t
 11       set dt = null;
 12
 13    execute immediate 'alter table t modify dt date';
 14
 15    forall i in 1..l_id.count
 16      update t
 17         set dt = to_date(l_dt(i), 'dd-mm-yyyy')
 18       where id = l_id(i);
 19  end;
 20  /

PL/SQL procedure successfully completed.

SQL> desc t
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ID                                                 NUMBER
 DT                                                 DATE

SQL> select * from t;

        ID DT
---------- ---------
         1 05-AUG-14
         2 06-AUG-14
         3 07-AUG-14
         4 08-AUG-14
         5 09-AUG-14
         6 10-AUG-14
         7 11-AUG-14
         8 12-AUG-14
         9 13-AUG-14
        10 14-AUG-14

10 rows selected.

SQL>

Tags: Database

Similar Questions

  • Rename the file after the shooting

    Is it possible to rename the files after the shooting? I need to associate each product pictures a thousand to its code to bars and I have no idea how fast.

    If you already know every name, you need to be, you can do it in a batch file.  I used a spreadsheet to build orders quickly before, then paste them into Notepad, save as a batch, and then run it.

    You will need to know, ahead, of what each image original name and the name of bar code is.

    You can simply highlight the list of orders for change of name and paste it into a prompt for this flow and execute all the orders for you.

  • The Pro Adobe bought, downloaded the file (with 1, 67MB) on laptop with OS Win8. When you try to install (my memory C: 2.39 GB free) the file, Adobe dialog says "the computer memory space is not enough. This is ridiculous. What can I do?

    The Pro Adobe bought, downloaded the file (with 1, 67MB) on laptop with OS Win8. When you try to install (my memory C: 2.39 GB free) the file, Adobe dialog says "the computer memory space is not enough. This is ridiculous. What can I do?

    Just click on the link acrobat XI and download download Acrobat pro products, acrobat XI | Standard, Pro | XI, X

  • Help! MicrosoftOffice 2011 cannot open the files after the recent update

    After the recent update (security 2015-006, Mac OS 10.10.5, Yosemite), I can longer open all files in Microsoft Excel or Word.

    When I tried to open the files in the "Open recent" list, Excel reports "Excel cannot open the workbook. The file name or path contains invalid characters (for example, /). "Same error message appears when I go into the folder and open the file in Excel.

    When I tried to open an existing file of the word, he pointed out that "this is not a valid file name.

    PS: Please do not suggest you use everything as your other favorite programs.

    Click the folder just below the recent and see if documents are on my Mac. Additionally, click on a reader-Documents-then the file name and see if the same thing happens. I downloaded the update of security on the App Store and have no problem. Also, in your menu bar, go to help in the Office applications and updates. An Office 2016 update was released last Friday, December 11.

  • How to free the memory after the end VI

    The data is collected once in a loop and added to a table of data. The collection was completed after the loop ends and a data table was built. In the end, the data has been written to a file. The program ended naturally. I guess that all the variables are erased from memory after the end, but it wasn't. If I run the program twice without closing, I have a set of newly collected data added to the 'old', which was created in my last run. A third series has been added if I run it once more.

    I just want to keep the last function as my data and I don't want to close the program to set all my settings to similar races. How to do?

    A sample file is attached.

    Thank you.

    You need to wire a constant empty table to the Terminal (lower bound) of the feedback node initializer.

  • Change to save the file after 20 seconds

    Hello world

    I am trying to acquire data at a frequency of 50 Hz (random numbers for this test) and send to a lower loop with an architecture of producer-consumer. I would change my saving file after 20 seconds (or N seconds) automatically.

    I put a saving botton and a stop one but if I press the Stop botton, my VI does not close.

    I really don't know what could be the problem.

    Thank you in advance!

    Hi Lorenzo,.

    the block "Dequeue Elelement" has a defined timeout value. By default, one is - 1, it will wait indefinitely the incoming elements in the upper loop. So if you stop the upper loop, the bottom will keep waiting until you press "Cancel".

  • a table in the file writing

    Hi I have a program that extracts data from two separate meter inputs and I want to write data to a file.

    I used a producer-consumer based structure to predict the fastest data entry of my application. All the data records in a file requested but it do not tabulate the data as I want. I like it to be something like this:

    time, 1 meter, 2 meter.

    0, 1, 1

    1, 2, 2

    for the moment, it produces a file like this:

    time, 1 meter.

    2 meter,

    0, 1

    1

    1, 2

    2

    So basically what I'm saying, is that it is tabulating the two entrances to the meter of a column and I would have preferred separate columns. I'm sure it's something simple, but may not know - help would be appreciated me. I have attached a picture of my program and the file written.

    Thank you very much

    Notay

    Make sure that the 'convert to dynamic data' vi is set to 'table 1 d of scalars - several channels.

  • Windows media player error "Windows Media Player has encountered a problem when you try to read the file" after burning CDs.

    Original title: "missing songs" in my windows media player then burn them on several cd :((

    I burned songs to several cd using my Windows media player to make different Cd, but after I returned to my library all the songs that I burned to the CD have disappeared, they are there, but they won't play it is as if they have been deleted, a window appears saying that windows media player has encountered a problem when you try to play the file. I did not notice this until after Cd burning a few I can't do more because if I keep going I'm not going to have more songs in my library! I don't know what to do im going crazy, it took me a long time to get all of these songs and now he disappeared! I have Windows 7 Ultimate is the version 12.0.7601.17514 hope that helps

    Hello
     
     
    They were playing before you burn CDs?
     
     
    Method 1:
    Open the troubleshooting Windows Media Player settings Troubleshooter
    http://Windows.Microsoft.com/en-us/Windows7/open-the-Windows-Media-Player-settings-Troubleshooter

    Method 2:
    This problem may be due to database corruption. You can delete the Windows Media Player database and check if the problem persists.

    Steps to clear the database of windows media player:

    a. exit Windows Media Player.
    b. Click Start, run, type %LOCALAPPDATA%\Microsoft\Media Player and then click OK.
    c. Select all files in the folder and then click on Delete on the file menu.

    Note you don't have to remove the folders that are in this folder.

    d. restart Windows Media Player.

    Note: Windows Media Player automatically rebuilds the database.

    If this does not resolve the problem, disable the Windows Media Player database cache files. To do this, follow these steps:

    a. exit Windows Media Player.

    b. Click Start, click Run, type % LOCALAPPDATA%\Microsoft and then click OK.

    c. Select the Media Player folder, and then click on Delete on the file menu.

    d. restart Windows Media Player.

    Note Windows Media Player automatically rebuilds the database.

  • Try to restore the files after replaced HD, 'backup location is not available' despite having backup full

    New HD installed and have all my backup files. When I use files restore - advanced restore - they are on an external hard drive, it is said first that the backup file is not available, although I can see all the files on the hard drive. Then asks me to create an account with the same name that my old account, she wants one with a / symbol in there, but said then I can't use symbols. The only way I can get the files to cross is to choose a different location to save in but then of course they are not anyone is easy to use... I would like that all of the images in the photo file, all the music in the music file, etc..  Also as I have many back ups I don't know which of the back ups to install - latest seems to have only the files that have changed since the last backup... what I need to install the oldest and the newest? or all of them? and I'm supposed to now spend hours finding all files and moving them to the right places? Guess that's what an automatic backup system was supposed to avoid...

    You use the option "files from a backup made on a different computer? Although it is the same computer, the fact that Vista has been reinstalled means that it may seem as if it isn't.

    The DELL PC anne/anne account that is specified is actually the name of the computer before the slash, is anne DELL PC and the user name after, Anne. The computer name was changed when has been reinstalled Vista?

  • Movie Maker - Corrupt the file after registration and addition of extention

    Hello

    I just saved a LARGER project on Windows Movie Maker version 2.6 on my external hard drive and I wanted to put it on DVD and I installed the Codec of high definition to put it on DVD, Grandpa Johns website, and now it won't let me open the file from my hard drive on any computer. The icon indicates sound, recorded as a project. 2 073 KB, but when I click it, it says "Windows Movie Maker cannot open this file" EVEN after uninstalling the Codec. I also have another version saved on my desktop in addition to my external hard drive, which gives me the same problem! Help, please!

    Hello

    I just saved a LARGER project on Windows Movie Maker version 2.6 on my external hard drive and I wanted to put it on DVD and I installed the Codec of high definition to put it on DVD, Grandpa Johns website, and now it won't let me open the file from my hard drive on any computer. The icon indicates sound, recorded as a project. 2 073 KB, but when I click it, it says "Windows Movie Maker cannot open this file" EVEN after uninstalling the Codec. I also have another version saved on my desktop in addition to my external hard drive, which gives me the same problem! Help, please!

    ============================================
    What is the saved file format (extension)?

    Sometimes corruption problems develop when projects become too big and
    complex. It is best if you create several smaller projects and publish
    (all of them in video format .wmv and then import the collected record)
    Filegroup .wmv in DVD Maker... each clip becomes a scene
    (chapter).

    John Inzer - MS - MVP - Digital Media Experience - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • Cannot save files Windows 7, sharing violation excel 2007 - have lost many hours of work that it corrupts the file, after it tried so-called recovered-the same file on the machine xp without problem.

    Cannot save files Windows 7, sharing violation excel 2007 - have lost many hours of work it corrupts files after he supposedly has found and tried the same (copied) files on the machine xp without problem. Also sometimes on the stand alone machine without network and excel files generated on this machine. Any thoughts?

    If you use Internet Security of Trend Micro with Windows 7, this combination is probably what is causing the problem.

    To fix this, open the main Trend Micro Internet Security (or similar). Open the Virus & Spyware controls. Choose the Protection against viruses & Spyware; Click settings, then advanced settings. Uncheck the box next to 'save files before you try to remove the virus '.

    This solved my save all problems in Excel 2007 and Word 2007.

  • Easy transfer gets "Can not open the file" after update from XP to 7

    In Windows XP Sp3, I created the Windows Easy Transfer file on a USB - I see it. I did the Custom installation of Windows 7 that seems successful. When I try to access my data using file transfer, the program will not open the file, although he sees there. Is there a way to retrieve this file?
    I saw similar posts but have not found one with an answer yet.
    Thank you

    Agrivated after myself, I found the problem.  And it's simple!  I hope it works for everyone, always in need of response.  So I upgraded to Win Xp 32 bit to 7 64 bit.  I had a 39 + GB Easy Transfer file.  I was getting the same error, «...» "Cannot open a file... "Well, to solve this problem, I opened the Transfer Wizard, thenm go through your files, using the options"Advanced"and my limited to a size of transfer to 2 GB or less.  It could be a tedious job, but it should work for you, as it did for me.  You can experiment a bit more with the measures, but I've just stuck with 2 GB and was fine.  Good luck to you all

  • Security of the files after printing

    What happens to the file sent to the eprint after printing - they are purged?

    They are deleted. They are not stored.

  • try to extract the files after downloading a program, the error message

    Cs6 Adobe Creative Suite Design & Web Premium. have downloaded successfully, and when I go to "Run" and extract the files and save it in a folder it tells me to

    "check the rights in writing on the destination folder or the space on my computer. I just wiped my computer and there defiantly of the space. I don't know what the 'writing' is. I'm on the administrator account for the computer, I had this specific programs on this computer before I wiped it and last time I have had no problem download of this. Also this message comes after the first message,

    error.png

    Any ideas?

    Run all programs as Administrator http://forums.adobe.com/thread/969395 to assign FULL... Permissions said yet, but it is sometimes necessary for Adobe

  • Cannot select Images of the files after import

    Hello.

    I'm new to Lightroom.  I created a catalog last night by import (add) approximately 33 000 existing images to my hard drive.  They are organized into folders by date.  For some reason, I can select folders and Images in the left panel of all records before a certain date, but may not for files after a certain date.  No idea what's going on.  Maybe gone bad import?  If I click on a problematic file the Image will change in the little window above the list of records, but not in the main window of the plant.  Thanks for the help!

    Here's a post about the limit of 1600 records in a parent folder:

    Re: Folders appear in the catalog, but unable to see the photos in folders after a certain folder

Maybe you are looking for