Copy columns from one Table to the other with PL/SQL in Apex

So my goal long-term is to throw this PL/SQL statement in a trial DMBS_SCHEDULER Apex 4.1 to create historical snapshots of the data a week but I'm hooked on this code:

declare
V_DEKIT_ID varchar (255);
V_NT varchar (255);
Number to resume;
Date of V_DDATE;

Start
for DEKIT_ID in (select * from DKT_HIST)

loop

Select DEKIT. DEKIT_ID in V_DEKIT_ID of DEKIT;
Select DEKIT. NT in DEKIT V_NT;
Select DEKIT. QUANTITY back of DEKIT;
Select CURRENT_DATE in double V_DDATE;

insert into DKT_HIST (DEKIT_ID, NT, QUANTITY, DDATE)
values (V_DEKIT_ID, V_NT, V_QUANTITY, V_DDATE);
end loop;

end;

I enter this code in the SQL prompt in the SQL workshop and it is said that she is treated, but when I look at the destination table (DKT_HIST), there is no data. Any help would be appreciated.  In this code I want to copy the three columns of the DEKIT table as well as the current date and copy them to DKT_HIST for each row in the table DEKIT.

Thank you

-Steve

The reason why your code did nothing is probably because your loop, using the history table. And since there no data in the historical table first, there is nothing to loop.

BUT!

Good code is the task with the least possible effort. Which in your case should result in a code similar to this:

begin
   insert into DKT_HIST (DEKIT_ID,NT,QUANTITY,DDATE)
   select DEKIT_ID,NT,QUANTITY, trunc(sysdate)
   from DEKIT;
end;

Tags: Database

Similar Questions

  • Problem: Build a VI to display a string in the table of the lights. Each letter must be posted in a separate table and letters must move from one table to the other in the direction from left to right.

    Hi all

    Problem: Build a VI to display a string in the table of the lights. Each letter must be posted in a separate table and letters must move from one table to the other in the direction from left to right.

    I did program mentioned above but it does not work. Can you tell me what is the problem?

    There is no error is indicated in the program. If someone knows about it please try to find solutions and help me out of this problem.

    I have attached my program with this message.

    Thank you in advance!

    (1) FOR loops are your friend here.  You can make a slight restructuring using loops, and then you will have less mess to deal with, the inner loop through tunnels of autoindexing to make it even simpler.

    (2) I would only treat the numeric values of the characters.  So go terminal of control of the chain, the capital letters and byte array to before the outer loop.  You can use a size of Board over there to tell how many times the outer loop to iterate.

    (3) the Index table is extensible.  So you only need over the index of the first, and it will increment itself, as it develops.

    (4) you need to finish the lookup table (table 3D)

  • Copy data from one table to the new table

    Hello

    I copy data from columns of a table to another table and my query is
    INSERT INTO TestTable (empno, empName, deptno)
    SELECT empno, empname, deptno
    WCP

    and it works fine but I want to insert a data column in testTable based on emp.deptno
    as if emp.deptno = 10 it will add 1 to the testtable.class column,
    If emp.deptno = 20 it will add 2-column testtable.class,
    If deptno = 30 it will add 3 to the testtable.class column,


    TestTable structure is
    EMPNO NUMBER (20)
    ENAME VARCHAR2 (50)
    DEPTNO NUMBER (20)
    CLASS NUMBER (20)

    Can someone please help me write this procedure.
    Thank you

    You can use a case statement as

    INSERT INTO TestTable (empno, empName,deptno,class_column )
    SELECT empno, empname,deptno, case when emp.deptno=10  then 1
                                       when emp.deptno=20  then 2
                                       when emp.deptno=30  then 3
                                  end
    FROM emp
    

    See you soon
    Katia

  • How can I copy light from one window to the other in a photo?

    I'm looking at printing an image I shot the winter as our map of Christmas this year. There are three windows in a medieval building, each consisting of several components in the lead and the one on the far left is turned on. My partner would in the middle one turn on as well. Is this doable without committing a lot of time to the project or do I need to book the snow again and organise a reshoot?tempest anderson lo res_edited-1.jpg

    Here I used the Polygonal Lasso to select half top of the Panel to the right of the lighted window and copy and paste this into a new layer.

    Then reproduces this layer, aligned vertically on two layers, linked to them and moved them on top of the dark window.

    You can then merge together and duplicate the fusion 3 times the value to fill the other 3 panels.

    Note: to select the start window you can also use the selection brush: use a hard square brush, the size of the window, click on the upper part of the window and holding shift button, drag the mouse down to select the rest (shift requires the mouse to move it to the bottom).

  • Composite planning form, copy data from one tab to the other?

    This is something I've heard of someone who did but have not actually seen. The requirement is to copy data from an existing entity to a new entity as a means of values seedlings early in the budget cycle. I was thinking about a form of 'source' and a form of 'target' within a composite shape. A calc would make a copy. After copying the Scheduler can manually adjust values, or type values in the accounts that the source had no data.

    If someone did please let me know how you did and what looked like the calc.

    Thank you!

    FA

    Hello

    Yes, this can be done in several ways. The calc script would be similar to what is mentioned above. But in regards to the copy, you can also create a menu on the source form set a rule of company on the menu and start the copy that also offer users the ability to choose several invited outside of the entity if necessary.

    Thank you

  • Creation of interface that won't use c $ table while getting data from one table to the other.

    Hello

    That was the question asked in an interview.

    Given the scenario has been that I have two servers say s1 and s2, each containing a database with tables source1 and source2 respectively...

    And I have a target table on server 2 with name target 1.

    Cent were as

    1 can data ufetch target1 source1 without creating table C $? If Yes, how can it be achieved.

    2. how temporary will be created all to get ata in source1 and source2 to target1? Explain the same thing?

    Also I would like to know what is the actual use of the c arrays $? Why they are used.

    I would be very grateful for answers.

    Thank you and best regards,

    Mahesh

    Hello

    Look at these links.

    http://odiexperts.com/why-creating-a-separate-schema-for-temporary-tables-in-ODI/

    Also this

    http://odiexperts.com/direct-load-by-interface-with-no-work-tables/

    Concerning

  • How to copy columns from one table to another

    Hai All


    How to copy the contents of the array to another

    For example, first name of the table is T1 and I have 10 columns and data are here and I need to create a table T2

    But I don't need the header, but not the values of all the 10 columns of T1 to T2, but not values


    Thanks and greetings

    Srikkanth.M

    Why not?

    create table test1
    as
       select * from emp
       where 1 = 2;
    

    Kind regards.

    LOULOU.

  • How can I copy files from one disk to the other?

    I want to copy all my mp3 files from my ITunes music folder on an external hard drive.  I'm not interested in records, only the mp3 of themselves.  I got here in 'terminal' that I can execute a command?  Please notify.  Thank you.

    Just use the search function in the Finder.

    Select the folder enclosing and type MP3 in the search.

    If you have not changed the search preferences, you will need to click on the name of the folder next to "this Mac.

    It should list all the MP3 files.  Select all and drag to the external hard drive.

  • How can I copy information from one image to the other GPS?

    I bought a Canon S100 specifically for its GPs and film.  These last vacation, I used the S100 and a Nikon D300.  In cases where the images were taken with both cameras roughly the same place, I would like to copy GPS information to CR2 S100 files to the D300 NEF files.  Does anyone know how to do this or if there is no plugins that will do it?

    And the answer is!   LIGHTROOM Beta 4!  It does everything I need.  Just announced today!

  • Did anyone see a problem when you drag items from first from one monitor to the other with the windows which distort?

    When you drag the window of creative for a monitor to another false windows showing a trail of the toolbars at the bottom of the page. The window does not appear correctly until you press ctrl + alt + del. Anyone have any suggestions on this subject? First Adobe and the GPU driver is up to date. There are no onboard graphics on this computer, only the nvidia gtx 760.

    Downgrading to 340.52 driver solves the problem.

  • Shutter button to copy records from one table to another;  ORA-04091:

    Hello

    I am trying to create a trigger that will move data from one table to the other.

    I have two tables (Trial1, Trial2) two of them contains the same attributes (code, c_index)

    I want to spend each new record inserted in (code Trial1) (code in Trial2)

    It's my trigger:
    Create or replace trigger trg_move_to_trial2
    After Insert on Trial1
    for each row
    Start
    insert into Trial2 (code)
    Select: new.code of Trial1;
    end;
    He compiled, but when I insert a new record (the code) in (Trial1), it shows this error:
    Error report:
    SQL error: ORA-04091: table STU101. TRIAL1 is changing, function of triggering/can not see
    ORA-06512: at "STU101. TRG_MOVE_TO_TRIAL2', line 3
    ORA-04088: error during execution of trigger ' STU101. TRG_MOVE_TO_TRIAL2'
    04091 00000 - "table %s.%s is changing, function of triggering/can not see.
    * Cause: A trigger (or plsql user-defined function that is referenced in)
    This statement) attempted to watch (or modify) a table that has been
    in the Middle being modified by the statement that shot.
    * Action: Rewrite the trigger (or function) so it does not read this table.
    I know matter what it means error, but I did not how to fix the error.

    ..................................................................................................

    I tried to change the (insert after on Trial1) before (insert on Trial1); It worked, but not in a good way. When I insert value in (code Trial1) new and refreshed Trial2 table, just as much as the records I have 2 test they will be duplicated. For example
    Trial2
    code
    111
    222
    333
    when I insert in Trial1
    Trial1
    code
    444
    Trial2 will be:
    code
    111
    222
    333
    444
    444
    444
    can you please tell me how to fix this?

    Kind regards

    Published by: 1002059 on April 23, 2013 17:36

    You should not select Trial1 - you already have data. Simply insert this value.

    Create or replace trigger trg_move_to_trial2
    After insert on Trial1
    for each row
    
    begin
    
    insert into Trial2 (code)
    values (:new.code);
    
    end; 
    

    Kind regards
    David

  • I'll copy Mozilla firefox from one computer to the other. I don't want to download from the internet, I caught the virus of "Babylon" in this way.

    (1) you really have to make it easier to contact support. Get rid of password requirements!
    (2) I would copy safely Firefox from one computer to the other. I don't want to download from the internet. Really, we love and use firefox. I had to remove firefox because it came with the virus of Babylon.

    If you have been Babylon when you installed Firefox you may have installed it from an authoritative source (the only official place and secure to download Firefox from www.getfirefox.comEast). Please, never download Firefox from anywhere else.

    So, for your computers, be sure to download Firefox from www.getfirefox.comand you download the version official, convenient and safe.

    If you get Babylon on your computer, you can remove it easily without having to remove Firefox by reading How to remove the toolbar of Babylon, home page and search engine (Please note that Babylon is not affiliated with Firefox and we actively seek to solve these problems).

  • Is there a way to copy / transfer / export existing assets from one site to the other?

    Is there a way to copy / transfer / export existing assets from one site to the other?

    I have like 20 + documents in one of my sites that I need to transfer to another site... What is a quick way to do without re - upload all my new Web site?

    Anyway, you would still re - download.

    If they are both sites of Muse you can open sites in Muse and copy and paste the desired content moved above.

  • Passing the value from one page to the other page

    Hi gurus,

    I need to pass the value from one page to the other page and two pages use different AMs.
    In the first page I have sellers results region table where the $vendor_name column is a hyperlink that navigates to the page Vendor_Sites. Now after accessing the second page, I want to excute the VendorSitesVO in PR of CO based on the value passed to VendorsVO (vendor_id) of first page.

    can someone help me on this?

    Thank you
    Vincent.

    Published by: user4933347 on December 4, 2009 12:19 AM

    You can set parameters of Pagecontext and transmit values through them. These values can be passed between pages, even if the AMs are different.

    Try:
    pageContext.putParameter ("Parameter1", value1);
    pagecontext.setForwardURL (second page)

    Concerning
    Sumit

  • How can I transfer photoshop cs5 from one laptop to the other?

    How can I transfer photoshop cs5 from one laptop to the other?  I bought a new macbook pro, I disabled the photoshop of my old laptop, all copied application files from adobe on an external hard drive and put them on my new laptop, but I can't open photoshop.  I don't know what to do.

    You do not copy, you INSTALL using the disc you bought it

    Download & install instructions https://forums.adobe.com/thread/2003339 can help

    -includes a link to access a page to download the Adobe programs if you do not have a disk or drive

    Also go to https://forums.adobe.com/community/creative_cloud/creative_cloud_faq

    - and also read https://forums.adobe.com/thread/1146459

    You must ALSO make the additional steps to install OLD programs on El Capitan

    This information is a MUST to install old programs on Mac El Capitan

    -You can't get the same error message, but these links that CAN help with old programs

    Install CS5 on Mac 10.11 https://forums.adobe.com/thread/2003455 can help (also for others than CS5)

    -also a TEMPORARY security change https://forums.adobe.com/thread/2039319

    -http://mac-how-to.wonderhowto.com/how-to/open-third-party-apps-from-unidentified-developer s-mac-os-x-0158095 /

    FAQ on the Mac 10-11 https://forums.adobe.com/thread/1979303

Maybe you are looking for

  • error code - 50

    I was trying to update my I-phone with IOS 10.02 6.  While it was updating the phone, I received an error code-50.  the phone is now stuck and I can't seem to exit the mode "update."  What does this error code mean?

  • Help me, why my son disappeared

    CCan anyone explain why my son disappeared? The thread that disappeared was this: https://discussions.apple.com/message/29709725?ac_cid=op123456#29709725

  • Problem upgrading Vista to windows 7 on Extensa 4420

    I'm in trouble, the upgrade from Vista to windows 7. I have purchaced a legal copy of 32-bit windows 7 Home premium, version even a Vista. I tried the udate instal to preserve my programs & settings. I had an error and system back to Vista. I then tr

  • How to call the setting menu of the BIOS on HP DV4 1540us netbook?

    Hi all How to call the setting menu of the BIOS on HP DV4 1540us netbook? F2 does NOT an on-screen BIOS setting. Is there another trick?  Or, perhaps, defining the procedure step by step to start the BIOS? TIA

  • Doctor id 907mbk - 52 k 709-xd002j-60xu03

    What I do for the error in the subject that I find in short dst? Product id wk571ea #abz?