How can I make this update, when I have two records (a primary key, no seq)

How can I make this update in pl\sql
Below is the table with data
CREATE TABLE INSERT_TE
( 
PIDM        VARCHAR2(8), 
FORM_ID     VARCHAR2(2),
TEACHER     VARCHAR2(30)
)
INSERT into INSERT_TE
(
PIDM,
FORM_ID,
TEACHER 
)
SELECT 
'1106651', 
'TE',
'Teacher, Alber Howard' 
from dual
commit;
INSERT into INSERT_TE
(
PIDM,
FORM_ID,
TEACHER 
)
SELECT 
'1106651', 
'TE',
'Teacher, Alber2 ' 
from dual
commit;
INSERT into INSERT_TE
(
PIDM,
FORM_ID,
TEACHER 
)
SELECT 
'2321241', 
'TE',
'Teacher, Silly Billy ' 
from dual
Commit

You're going to end with something like this: in a cursor...
PIDM     FORM_ID     TEACHER
1106651     TE     Teacher, Alber Howard
1106651     TE     Teacher, Alber2 
2321241     TE     Teacher, Silly Billy
so I need to update a table

If there is only one file like this 2321241 teacher YOU, Billy Silly
no problem I'm
UPDATE   saturn.sarchkl
         SET
         sarchkl_receive_date = SYSDATE,
         sarchkl_activity_date = SYSDATE,
         sarchkl_source = 'U',
         sarchkl_source_date = SYSDATE
         WHERE
          sarchkl_pidm = v_pidm3
          AND sarchkl_receive_date IS NULL
          AND sarchkl_term_code_entry = p_term
          AND sarchkl_admr_code = 'REC1'
But if there's a PIDM (pk) with two records
PIDM FORM_ID TEACHER
1106651 TE Teacher, Alber Howard
1106651 TE Teacher, Alber2 
I need to make 2 updates (notice the rec1 sarchkl_admr_code AND for the firs and rec2 during the second
The first record should update the table when the condition is sarchkl_admr_code = "REC1" and the second disc with the
condition is sarchkl_admr_code = "REC2.
UPDATE   saturn.sarchkl
         SET
         sarchkl_receive_date = SYSDATE,
         sarchkl_activity_date = SYSDATE,
         sarchkl_source = 'U',
         sarchkl_source_date = SYSDATE
         WHERE
          sarchkl_pidm = v_pidm3
          AND sarchkl_receive_date IS NULL
          AND sarchkl_term_code_entry = p_term
          AND sarchkl_admr_code = 'REC1'
and
UPDATE   saturn.sarchkl
         SET
         sarchkl_receive_date = SYSDATE,
         sarchkl_activity_date = SYSDATE,
         sarchkl_source = 'U',
         sarchkl_source_date = SYSDATE
         WHERE
          sarchkl_pidm = v_pidm3
          AND sarchkl_receive_date IS NULL
          AND sarchkl_term_code_entry = p_term
          AND sarchkl_admr_code = 'REC2'
I do this in pl\sql, I don't have a sequence in the INSERT_TE table, how do I know that the first record in
1106651 TE Teacher, Alber Howard
1106651 TE Teacher, Alber2 
updated a rec1 and the second updates when sarchkl_admr_code = "REC2."

I guess I can create a sequence, but I'm inserting a table of a select statement, I get the error message
ORA-02287: sequence number not allowed here, when I try to do the following:
 
 INSERT INTO SYTEACH
( 
SYTEACH_PIDM,
SYTEACH_ID,
SYTEACH_TEACHER,
SYTEACH_SEQ
)
SELECT   
      DISTINCT
      spriden_pidm, 
      sarchkl_admr_code, 
      szsform_form_id, 
      szsform_schl_off_type||', '||szsform_schl_off_firstname||' '||szsform_schl_off_lasttname teacher,
       SZSFORM_SEQ.NEXTVAL
        FROM   saturn_midd.szsform, saturn.spriden, saturn.sarchkl
       WHERE       spriden_ntyp_code = 'CAPP'
               AND szsform_common_app_id = spriden_id
               AND spriden_pidm = sarchkl_pidm
               AND sarchkl_admr_code = 'REC1'
               AND szsform_form_id = 'TE' 
 
What is the simple way to make this update...

Hello

you said:

>
But if there's a PIDM (pk) with two records

PIDM $FORM_ID TEACHER
TE 1106651 teacher, Alber Howard
1106651 TE, Alber2 Professor
>

Loc PKS are unique! (otherwise we don't call them pk)

For your table, you can set a single like this:
PIDM column + a sequence. (new heading):

ALTER TABLE INSERT_TE ADD(TEACH_SEQ NUMBER)
/

UPDATE INSERT_TE x
   SET TEACH_SEQ =
          (SELECT n
           FROM   (SELECT ROWID rid,
                          ROW_NUMBER() OVER(PARTITION BY pidm ORDER BY TEACHER) n
                   FROM   INSERT_TE t) s
           WHERE  s.rid = x.ROWID)

PIDM     FORM_ID     TEACHER     TEACH_SEQ
1106651     TE     Teacher, Alber Howard      1
1106651     TE     Teacher, Alber2       2
2321241     TE     Teacher, Silly Billy      1

I need to make 2 updates (notice the rec1 sarchkl_admr_code AND for the firs and rec2 during the second
The first record should update the table when the condition is sarchkl_admr_code = "REC1" and the second record with the condition is sarchkl_admr_code = "REC2.
>

not normally.

but you can do (now)

select PIDM, FORM_ID, TEACHER, 'REC'||TEACH_SEQ TEACH_SEQ from INSERT_TE

PIDM     FORM_ID     TEACHER     TEACH_SEQ
1106651     TE     Teacher, Alber Howard     REC1
1106651     TE     Teacher, Alber2      REC2
2321241     TE     Teacher, Silly Billy      REC1

and use the last column to update you...

Published by: user11268895 on August 20, 2010 14:01

Tags: Database

Similar Questions

  • whenever I open the browser, plugins check page always opens in a second tab. How can I make this stop?

    Whenever I open my browser, plugins check page keeps opening, even though I've updated all my plugins.

    How can I make this stop?

    This is a bug with plugin blocklisting has been corrected.

    You can correct this problem by forcing the blocklist.xml file to update or wait until Firefox updates the file.

    This update will remove the gravity = '0' flags in the file that causes the problem.

    See:

    • Bug 663722 - the release of blocklist is notably gravity = '0' where it should not be
  • How can I disable this update mechanism

    Original title: update Windows

    Windows 8

    I have Windows update disabled.

    Why is it always check?

    Why did he did install an update at startup? (Installation of screen updates but no updates listed in the windows update log)

    What is SkipSelfUpdateCheck indicator research defined?

    How can I disable this update mechanism?

    Recently had the battery software updated to date because the battery would not charge. (Best Buy/Lenovo)

    Part of the newspaper - no longer available

    2014-01-26 17:54:38:025 996 c10 at THE #.
    2014-01-26 17:54:38:025 996 at THE c10 # START # to THE: research updates
    2014-01-26 17:54:38:025 996 c10 at THE #.
    2014-01-26 17:54:38:025 996 c10 additional service {117CAB2D-82B1-4B5A-A08C-4D62DBEE7782} with the approval type {pre-installation notify} added to the list of services to THE
    2014-01-26 17:54:38:025 996 c10 SkipSelfUpdateCheck Agent search indicator defined for serverId: 117CAB2D-82B1-4B5A-A08C-4D62DBEE7782
    2014-01-26 17:54:38:025 996 at THE c10<## submitted="" ##="" au:="" search="" for="" updates ="" [callid="{F3CFF46A-65F6-401B-AF23-D114B5BA1444}" serviceid="">
    2014-01-26 17:54:38:025 996 b34 Agent *.
    2014-01-26 17:54:38:025 996 b34 Agent * START * Agent: finding updates [CallerId = AutomaticUpdates]
    2014-01-26 17:54:38:025 996 b34 Agent *.
    2014-01-26 17:54:38:025 996 b34 Agent * Online = Yes; Ignore download priority = No
    2014-01-26 17:54:38:025 996 b34 Agent * criteria = "IsInstalled = 0 and DeploymentAction = 'Installation' or IsPresent = 1 and DeploymentAction = 'Uninstall' or IsInstalled = 1 and 'Installation' and = 1 RebootRequired = DeploymentAction IsInstalled = 0 and DeploymentAction = 'Uninstall' and RebootRequired = 1".
    2014-01-26 17:54:38:025 996 b34 Agent * ServiceID = {117CAB2D-82B1-4B5A-A08C-4D62DBEE7782} third service
    2014-01-26 17:54:38:025 996 b34 Agent * Search Scope = {Machine & All Users}
    2014-01-26 17:54:38:025 996 b34 Agent * calling applicability SID: S-1-5-18
    2014-01-26 17:54:38:118 996 b34 Misc validation signature for C:\windows\SoftwareDistribution\WuRedir\9482F4B4-E343-43B6-B170-9A65BC822C77\wuredir.cab:
    2014-01-26 17:54:38:134 996 Misc signed Microsoft b34: Yes
    2014-01-26 17:54:38:134 996 Misc signed Infrastructure b34: Yes
    2014-01-26 17:54:38:290 996 b34 Misc validation signature for C:\windows\SoftwareDistribution\WuRedir\9482F4B4-E343-43B6-B170-9A65BC822C77\wudownload.cab:
    2014-01-26 17:54:38:321 996 Misc signed Microsoft b34: Yes
    2014-01-26 17:54:38:321 996 Misc signed Infrastructure b34: Yes
    2014-01-26 17:54:38:321 996 b34 Misc validation signature for C:\windows\SoftwareDistribution\WuRedir\9482F4B4-E343-43B6-B170-9A65BC822C77\wuredir.cab:
    2014-01-26 17:54:38:337 996 Misc signed Microsoft b34: Yes
    2014-01-26 17:54:38:337 996 Misc signed Infrastructure b34: Yes
    2014-01-26 17:54:38:337 996 b34 EP had 9482F4B4-E343-43B6-B170-9A65BC822C77 redir SecondaryServiceAuth URL: 'http://fe1.ws.microsoft.com/w8/2/redir/storeauth.cab'.
    2014-01-26 17:54:38:384 996 b34 Agent looking for updates auth cab for 117cab2d-82b1-4b5a-a08c-4d62dbee7782 to http://fe1.ws.microsoft.com/w8/2/redir/storeauth.cab service
    2014-01-26 17:54:38:384 996 b34 Misc validation signature for C:\windows\SoftwareDistribution\AuthCabs\Downloaded\117cab2d-82b1-4b5a-a08c-4d62dbee7782.cab:
    2014-01-26 17:54:38:400 996 Misc signed Microsoft b34: Yes
    2014-01-26 17:54:38:400 996 Misc signed Infrastructure b34: Yes
    2014-01-26 17:54:38:665 996 b34 Misc validation signature for C:\windows\SoftwareDistribution\AuthCabs\Downloaded\117cab2d-82b1-4b5a-a08c-4d62dbee7782.cab:
    2014-01-26 17:54:38:665 996 Misc signed Microsoft b34: Yes
    2014-01-26 17:54:38:665 996 Misc signed Infrastructure b34: Yes
    2014-01-26 17:54:38:681 996 b34 EP had 117CAB2D-82B1-4B5A-A08C-4D62DBEE7782 redir server URL: 'https://fe2.ws.microsoft.com/v6/ClientWebService/client.asmx'.
    2014-01-26 17:54:39:259 996 b34 PT +++ PT: Synchronizing server updates +++
    2014-01-26 17:54:39:259 996 b34 PT + ServiceId = {117CAB2D-82B1-4B5A-A08C-4D62DBEE7782}, URL of the server = https://fe2.ws.microsoft.com/v6/ClientWebService/client.asmx
    2014-01-26 17:54:39:259 996 b34 Agent reading set cached app categories using life 604800 seconds
    2014-01-26 17:54:39:259 996 b34 categories 0 app caching of Agent read

    Hello

    1. how disable you the Windows updates?

    2 may I know the reason for deactivation of the Windows updates?

    Please note: Windows updates provide significant benefits, such as improved security and reliability that is why it is not recommended to disable Windows updates?

    That you have disabled the Windows Server Update Service, SelfUpdate ceased.

    When you try to use the service SelfUpdate of Microsoft Windows Server Update Services (WSUS) to send automatic updates on the client computers, client computers do not receive updates. In addition, client computers do not report to the WSUS server.

    See the article:
    Windows Update: frequently asked Questions
    http://Windows.Microsoft.com/en-GB/Windows-8/Windows-Update-FAQ

    I suggest also refer to this subject and check if it helps.
    http://answers.Microsoft.com/en-us/Windows/Forum/windows_8-windows_update/how-to-turn-off-Windows-Update/6a3ea008-59d9-4EF2-8dd6-97ff80a780be

    Hope this information helps. If you have more queries on windows, we would be happy to help you.

  • Update of Windows Vista, but Windows Live Platform says I need to install the platform update. How can I reinstall this update of the platform?

    Windows Live Mail installation

    I have vista service pack 2 installed and windows vista update also installed platform but windows live is to say that I need to install the platform update. How can I reinstall this update of the platform.

    Windows Live Mail questions belong here: http://windowslivehelp.com/product.aspx?productid=15

  • Windows 7, I did a "new folder" to put pictures in, how can I do this? When I select all and right click to add photos to my account, I don't see the folder

    I'm new to using Windows 7, I did a "new folder" to put pictures in, how can I do this?  When I select all and right click to add photos to my account, I don't see the folder...

    Drag and drop the video,

    http://www.YouTube.com/watch?v=6n3YKsgOdsk

    Or right-click and use cut then right click on the folder and select Paste.

  • How can I make this form?

    How can I make this shape in fireworks:

    shape.png

    I want some pictures in my site has rounded corners. Im making this by adding 4 divs with background images and absolutely positioned, one on each corner of the image. Background images are png with transparent areas. It works as the site background is a solid color, rounded corners do not need to be truly transparent.

    The issue im having is that the pixels on the curve must be semi transparent. ID like to make this shape as a vector, but I don't know how.

    Thank you

    You can do a vector shape like this perforating a circle within a square. Draw a square, draw a circle above it. Select the two objects, and then select Modify > combine paths > Punch. It would be much easier to export your images with corners rounded Fireworks, rather than hide the corners with divs positioned absoultely, however. To do this, draw a white, rounded rectangle on the image. Choose Selection > select all and then modify > mask > Group as mask. Change the color of the canvas to the color of your HTML page.

  • How can I change my country when I have a balance that I can't buy anything with? It will not change me cause I have a balance of 0.07 pence

    How can I change my country when I have a balance that I can't buy anything with? It will not change me cause I have a balance of 0.07 pence

    Click here and ask the staff of the iTunes Store to zero the balance of your account.


    (142584)

  • I just DOWNLOAD Adobe Creative but I need Photoshop for businesses, and now I find my PC creative cloud to teams after paying anyway € 29. How can I solve this problem? I have need creative Cloud but absolutely I need Photoshop!

    I just DOWNLOAD Adobe Creative but I need Photoshop for businesses, and now I find my PC creative cloud to teams after paying anyway € 29. How can I solve this problem? I have need creative Cloud but absolutely I need Photoshop! @

    You must contact Adobe to cancel the subscription you purchased

    Since this is an open forum, not Adobe support... you must contact Adobe personnel to help
    Chat/phone: Mon - Fri 05:00-19:00 (US Pacific Time)

    Creative cloud support (all creative cloud customer service problems)
    http://helpx.Adobe.com/x-productkb/global/service-CCM.html

    Then, you need to purchase the subscription that you want to

    Cloud Plans https://creative.adobe.com/plans

    -Special photography plan includes Photoshop & Lightroom and Bridge & Mobile Lightroom

  • I forgot my administrator password. How can I connect? I don't have my drive only product key.

    I forgot my administrator password. How can I connect? I don't have my drive only product key.

    http://support.Microsoft.com/default.aspx/KB/189126

    "Microsoft's strategy concerning lost or forgotten passwords"

    Microsoft cannot help you recover the passwords of the files and Microsoft who are lost or forgotten product features.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    How to get Vista recovery Media or the Vista recovery Partition on your computer back to factory settings.

    There is no Vista free download legal available.

    Contact your computer manufacturer and ask them to send a recovery disk/s Vista set.

    Normally, they do this for a cost of $ small.

    In addition, ask them if you have a recovery Partition on your computer/laptop to restore it to factory settings.

    See if a manual provided with the computer or go to the manufacturer's website, email or you can call for information on how to make a recovery.

    Normally, you have to press F10 or F11 at startup to start the recovery process...

    Another way I've seen on some models is press F8 and go to a list of startup options, and launch a recovery of standards of plant with it, by selecting the repair option.

    Ask them if you can also make recovery disk/s for the recovery Partition in case of a system Crash or hard drive failure.

    They will tell you how to do this.

    Every computer manufacturer has their own way of making recovery disk/s.

    Or borrow a good Microsoft Vista DVD (not Dell, HP, etc).
    A good Vista DVD contains all versions of Vista.
    The product key determines which version of Vista is installed.

    There are 2 disks of Vista: one for 32-bit operating system, and one for 64-bit operating system.

    If install a cleaning is required with a good DVD of Vista (not HP, Dell recovery disks):

    Go to your Bios/Setup, or the Boot Menu at startup and change the Boot order to make the DVD/CD drive 1st in the boot order, then reboot with the disk in the drive.

    At the startup/power on you should see at the bottom of the screen either F2 or DELETE, go to Setup/Bios or F12 for the Boot Menu

    http://support.Microsoft.com/default.aspx/KB/918884

    MS advice on the conduct of clean install.

    http://www.theeldergeekvista.com/vista_clean_installation.htm

    A tutorial on the use of a clean install

    http://www.winsupersite.com/showcase/winvista_install_03.asp

    Super Guide Windows Vista Installation

    After installation > go to the website of the manufacturer of your computer/notebook > drivers and downloads Section > key in your model number > get latest Vista drivers for it > download/install them.

    Save all data, because it will be lost during a clean installation.

    See you soon.

    Mick Murphy - Microsoft partner

  • computer automatically opens Internet start up how can I stop this? When I would use the computer and open internet when I'm ready to use it

    computer will automatically connect to IE start up how can I stop this.

    When I would use the computer and open IE when I'm ready to use it.

    I have a ZYXEL router.

    This has happened only since I checked a pop box that says connect automatically very stupid, I know, but now can not cancel.

    help please

    Hi Tansy,

    Thanks for posting your query in Microsoft Community.

    I understand how it could be frustrating when things do not work as expected. Please, I beg you, don't worry I'll try my best to resolve the issue.

    I understand that you want to disable the open Internet Explorer at startup option.

    Method 1
    Step 1: I suggest to start the computer in safe mode with network and check if the problem persists.

    Startup options (including safe mode)
    http://Windows.Microsoft.com/en-us/Windows7/advanced-startup-options-including-safe-mode

    Step 2: If the problem is solved in SafeMode with networking, then I suggest to perform clean boot and remove the program that is causing the problem.

    How to perform a clean boot for a problem in Windows Vista, Windows 7 or Windows 8
    http://support.Microsoft.com/kb/929135
    Note: Follow step 3 of section of boot KB929135 to reset the computer in normal mode.

    Method 2
    I suggest you run virus scan online by using the Microsoft safety scanner.

    Microsoft safety scanner
    http://www.Microsoft.com/security/scanner/en-us/default.aspx

    Note: when you do an antivirus online, you will lose data that are affected by the virus. Microsoft is not responsible for the loss of this data.

    See also: Stop a program from running automatically when Windows starts
    http://Windows.Microsoft.com/en-in/Windows7/stop-a-program-from-running-automatically-when-Windows-starts

    Thanks for posting the results and let us know if you need help to solve the problem and we will be happy to help you

  • How can I make this emphasis?

    I am a newbie and trying to recreate this image below. I know how to do the letters and the text, but how do I underscore below? If you download the image and zoom in to 2000% , you'll see that there are two different layers, the darker on top and layer just below. How can you do this?

    This isn't a regular point out also, I know that you can go highlight the text option, but it's different, Zoom 2000% to see what I mean

    Use could use the line shape layers tool and draw a straight line, the value

    Duplicate the layer, then move it below (using the tool move).

    Then use the parameter opacity to look semi transparent

    When your happy with placement and all, merge two shape layers

    and use the Eraser tool configured to block the cut around the letter p.

    MTSTUNER

    Post edited by: MTSTUNER

  • How can I make this object?

    Maybe that's... .mesh object...

    but I can't develop... or disassociate...

    What kind object? How can I do this?

    Please... Help me...

    Here is the link file have

    mesh.jpg

    Open your transparency Panel and you can get out of here and see how its construction.

    You end up with this...

  • How can I make this scroll

    Hello how can I do this kind of http://anthelios.laroche-posay.ca/en/beach animate scrolling with edge adobe?


    Hi Yigit

    I think that the following link can help you.

    http://www.Adobe.com/inspire/2014/01/Parallax-edge-animate.html

    Thank you

    Dieudonné

  • Is no longer, I can get my regular Hotmail. How can I correct this situation, because I have important emails in this account?

    Window live hotmail sign when only happens on my computer. However, I have to get in my old e-mail account with hotmail. How can I solve this problem? Send message to * address email is removed from the privacy *.

    Thank you

    Janice

    Hello

    for any hotmail questions please repost via hotmail portal in the link below

    http://www.windowslivehelp.com/product.aspx?ProductID=1

    Consult with Microsoft Certified Solutions
  • How can I make this button look better gif?

    I admit I'm fairly new to Illustrator... but if you can point me in the right direction, it will be greatly appreciated.

    All I have to do is create a GIF file that also looks good as a SWF file.  I played with all the settings and I can not understand how to do this!

    This is how it looks when I exported to GIF format

    buttonwithnodither.gif

    That's what I see in artificial intelligence. Letters are much better defined.

    buttonai.jpg

    How can I do I export a simple GIF and make it look great?

    Jose

    In the save for web and devices in the image check anti alias tab.

Maybe you are looking for