Move and Assign Statement

What is the difference between Move & assign statement?

Hi,
MOVE:
For eg,
I_MARA is the internal table which has 1 record,
TYPES: BEGIN OF STRUCT_MARA,
       MATNR TYPE MATNR,
       MTART TYPE MTART,
       MEINS TYPE MEINS,
       END OF STRUCT_MARA.
DATA: I_MARA TYPE STANDARD TABLE OF STRUCT_MARA WITH HEADER LINE.
data: v_matnr type matnr.
(if V_MATNR is a variable of type matnr (V_MATNR TYPE MATNR)).
Then,
The data has to be moved into V_MATNR,
ie,
MOVE: I_MARA-MATNR TO V_MATNR.
Note: MOVE can be used for tranfering data between two variables of same type also.
ASSIGN:
I_MARA is the internal table which has 1 record,
TYPES: BEGIN OF STRUCT_MARA,
       MATNR TYPE MATNR,
       MTART TYPE MTART,
       MEINS TYPE MEINS,
       END OF STRUCT_MARA.
DATA: I_MARA TYPE STANDARD TABLE OF STRUCT_MARA WITH HEADER LINE.
data: <f1> type any.
(if <f1>is a field-symbol of type any (<f1> type any)).
Then,
ASSIGN I_MARA-MATNR TO <f1>.
The field-symbol <f1> will point the address of the I_MARA-MATNR
Note: ASSIGN i s only used for field-symbols and it is used by the field-symbols to point the address of a field used in ASSIGN syntax.
hope this helps.

Similar Messages

  • Move and Assign?

    What is the difference between Move & assign statement?
    Edited by: Arun  Mehta on Jul 10, 2008 1:55 PM

    Hi
    If you already know the name of the field that you want to assign to the field symbol when you write a program, use the static ASSIGN statement:
    ASSIGN <f> TO <FS>.
    When you assign the data object, the system checks whether the technical attributes of the data object <f> correspond to any type specifications for the field symbol <FS>. The field symbol adopts any generic attributes of <f> that are not contained in its own type specification. After the assignment, it points to <f> in memory.
    To assign the value of a data object <f1> to a variable <f2>, use the following statement:
    MOVE <f1> TO <f2>.
    or the equivalent statement
    <f2> = <f1>.
    The contents of <f1> remain unchanged. <f1> does not have to be a variable - it can also be a literal, a text symbol, or a constant. You must always specify decimal points with a period (.), regardless of the useru2019s personal settings.
    Multiple value assignments in the form
    <f4> = <f3> = <f2> = <f1>.
    are also possible. ABAP processes them from right to left as follows:
    MOVE <f1> TO <f2>.
    MOVE <f2> TO <f3>.
    MOVE <f3> TO <f4>.
    Regards
    Pavan
    Edited by: Pavan Bhamidipati on Jul 10, 2008 1:59 PM

  • Ok i have the Iphone 5c and a Dell laptop. I loaded Itunes to both i bought a digital copy of a movie. Loade it to my Itunes on the Laptop. how do i put it on my phone? I try to finish downloading or uploading it and it states interupted go click availble

    Ok i have the Iphone 5c and a Dell laptop. I loaded Itunes to both i bought a digital copy of a movie. Loade it to my Itunes on the Laptop. how do i put it on my phone? I try to finish downloading or uploading it and it states interupted go click availble

    iTunes and Apple's devices work as an ecosystem. iTunes is designed to sync with Apple's products, not anyone else's. You'll need your songs in a format compatable with the Samsung phone and to use the software transfer program supplied/recommended. It is essentially not an Apple/iTunes problem. You may have better luck finding the information you need on Samsung's forums.
    tt2

  • Just upgraded to 10.7 - cannot play movies or TV programs - iTunes freezes and Windows states iTunes has stopped working and kicks me out - play audio OK, store and synching to devices OK.

    Running Windows Vista Home Premium - Service Pack2
    iTunes has always worked beautifully - opened it yesterday and said upgrade was available so I did and upgrade seemed to be successful - no errors and program launches and all my music, TV programs, Movies, etc, were there. Audio works well.  Tonight I tried to play a movie and got the Windows iTunes has stopped working and searching for solution (which there is none) and closing the warning box closes iTunes.  iTunes used to launch a "separate" black window for my movies/TV - I seemed to get  a black background before everything freezes.  Not happy.  Thanks for any help - I tried to upgrade quicktime just to make sure it wasn't lagging behind the iTunes upgrade but that didn't help.

    Let's try the following user tip with that:
    iTunes for Windows 10.7.0.21: "iTunes has stopped working" error messages when playing videos, video podcasts, movies and TV shows

  • [svn] 4709: * Move id assignment to after the instance is fully created.

    Revision: 4709
    Author: [email protected]
    Date: 2009-01-28 09:50:03 -0800 (Wed, 28 Jan 2009)
    Log Message:
    * Move id assignment to after the instance is fully created.
    tests Passed: checkintests, mxunit databinding
    Needs QA: YES
    Needs DOC: NO
    Bug fixes: SDK-16777
    API Change: NO
    Reviewer: Corey
    Code-level description of changes:
    Modified getDefinitionBody() and generateDefinitionBody() by moving
    the id assignment logic to just before the return statement.
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-16777
    Modified Paths:
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/rep/init/ValueInitializer.ja va

    Hi,
    not sure where to find original post. In RDB, it is MSP_EpmTask_UserView.TaskClientUniqueId.
    Sorry, if there are now 2 answers.
    Regards
    Barbara
    To increase the value of this forum, please mark the replies that helped to solve your issue as answer. If you find answers to questions from other forum participants to be helpful, please mark them as helpful. Your participation will help others to find
    an appropriate solution faster. Thanks for your support!

  • New ARB Issue:  Button navigation and Declarative States

    <[email protected]il.forums.adobe.com>
    Message-ID: <C6277898.7F37%[email protected]>
    Thread-Topic: New ARB Issue:  Button navigation and Declarative States
    Thread-Index: AcnOqlv/oTWkTNjMukqDP18VFO76uA==
    Mime-version: 1.0
    Content-type: multipart/alternative;
         boundary="B_3324475544_8859892"
    This message is in MIME format. Since your mail reader does not understand
    this format, some or all of this message may not be legible.
    --B_3324475544_8859892
    Content-type: text/plain;
         charset="US-ASCII"
    Content-transfer-encoding: 7bit
    A new ARB issue has been posted to the flex open source site:
    http://opensource.adobe.com/wiki/display/flexsdk/buttonnavigationand+decla
    rative+states
    This issue concerns the new state syntax and what it means to leave a value
    of a property implicit in one or more states.
    Comments, suggestions, and feedback are welcome.
    --B_3324475544_8859892
    Content-type: text/html;
         charset="US-ASCII"
    Content-transfer-encoding: quoted-printable
    <HTML>
    <HEAD>
    <TITLE>New ARB Issue:  Button navigation and Declarative States</TITLE=
    >
    </HEAD>
    <BODY>
    <FONT FACE=3D"Calibri, Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:11pt=
    '><BR>
    <BR>
    <BR>
    A new ARB issue has been posted to the flex open source site:<BR>
    <BR>
    <a href=3D"http://opensource.adobe.com/wiki/display/flexsdk/button+navigation=
    anddeclarative+states">http://opensource.adobe.com/wiki/display/flexsdk/bu=
    ttonnavigationanddeclarativestates
    This issue concerns the new state syntax and what it means to leave a value= of a property implicit in one or more states.
    Comments, suggestions, and feedback are welcome.
    B_3324475544_8859892

    Ned Murphy wrote:
    Select the textfield that is inside the movieclip and in the properties panel you should see a dropdown for selecting the type of textfield.  If you select Dynamic and then assign an instance name to the textfield you can use that instance name in your code to assign the text when the file runs.  If you were to name the textfield "tField", then the code you would use inside an instance of your movieclip named "mClip1" would be...
    mClip1.tField.text = "your text";
    So, if I have multiple buttons, using your example, would the code read
    mClip1.tField.text = "your text";
    mClip1.tField2.text = "your text2";
    mClip1.tField3.text = "your text3";
    mClip1.tField4.text = "your text4";
    And my buttons are built inside movieclips, ie
    Main Timeline > aboutButton_mc > aboutText_mc > "about"
                        > contactsButton_mc > contactsText_mc > "contacts"
    can the code be put at any level, or does it need to reside on the Main Timeline to access all the movie clips' text fields?
    Just in case this may be too complex to get into via this forum, if you know of any good tutorials, that would be awesome too!
    I tried doing a search, but it's so hard to tell if they might be in AS2, or AS3, and if they would apply to newer versions of Adobe Flash (I have CS5)

  • What is the difference between MOVE and WRITE TO ststement?

    Hi
    What is the difference between MOVE and WRITE TO ststement?
    When do we use both of them?
    Thank You

    Hi,
    <b>MOVE</b>
    Syntax
    MOVE source {TO|?TO} destination.
    destination {=|?=} source.
    Effect
    Both these statements assign the content of the operand source to the data object destination. The variants with the language element TO or the assignment operator = are valid for all assignments between operands that are not reference variables, and for assignments between reference variables for which the static type of source is more specific than or the same as the static type of destination(narrowing cast).
    Variants with the language element ?TO or the assignment operator ?= (casting operator ) must be used if the source and destination are reference variables and the static type of source is more general than the static type of destination (widening cast). For assignments between operands that are not reference variables, use of the question mark ? is not permitted.
    The data object destination can be any data object that can be listed at a write position, and the data object source can be a data object, a predefined function or a functional method (as of release 6.10). The data type of the data object destination must either be compatible with the data type of source, or it must be possible to convert the content of source into the data type of destination according to one of the conversion rules.
    Notes
    If source and/or destination are field symbols, then, as in all ABAP commands, the system works with the content of the data objects to which the field symbols point. The actual pointer content of a field symbol can only be changed using the statement ASSIGN or the addition ASSIGNING when processing internal tables (value semantics). If source and destination are reference variables, the reference contained in source is assigned to destination (reference semantics).
    Strings and internal tables are addressed internally using references. When assignments are made between strings and between internal tables (as of release 6.10), only the reference is transferred, for performance reasons. After the assignment, the actual string or the actual table body of the source as well as the target object are addressed (sharing). When the object is accessed to change it, the sharing is canceled and a copy of the content is made. The sharing is displayed in the memory consumption display of the ABAP debugger and in the Memory Inspector tool (as of release 6.20).
    Obsolete Form: MOVE PERCENTAGE
    Exceptions
    Catchable Exceptions
    CX_SY_CONVERSION_NO_NUMBER
    Cause: Operand cannot be interpreted as number
    Runtime Error: CONVT_NO_NUMBER (catchable)
    CX_SY_CONVERSION_OVERFLOW
    Cause: Overflow with arithmetic operation (type P, with specified length)
    Runtime Error: BCD_FIELD_OVERFLOW (catchable)
    Cause: Operand too large or (intermediate) result too large
    Runtime Error: CONVT_OVERFLOW (catchable)
    CX_SY_MOVE_CAST_ERROR
    Cause: Source or target variable are not reference variables
    Runtime Error: MOVE_CAST_REF_ONLY
    Non-Catchable Exceptions
    Cause: Source field (type P) does not contain correct BCD format.
    Runtime Error: BCD_BADDATA
    Cause: Assignment for deep structures not permitted if these overlap.
    Runtime Error: MOVE_COMPLEX_OVERLAP
    Cause: Type conflict with the assignment between object references.
    Runtime Error: MOVE_INTERFACE_NOT_SUPPORTED,
    Runtime Error: MOVE_IREF_NOT_CONVERTIBLE,
    Runtime Error: MOVE_IREF_TO_OREF,
    Runtime Error: MOVE_OREF_NOT_CONVERTIBLE
    Cause: Type conflict with the assignment between data references.
    Runtime Error: MOVE_DREF_NOT_COMPATIBLE
    Cause: Assignment between the types involved not supported.
    Runtime Error: MOVE_NOT_SUPPORTED
    Cause: Constants and literals must not be overwritten.
    Runtime Error: MOVE_TO_LIT_NOTALLOWED
    Cause: onstants and literals must not be overwritten.
    Runtime Error: MOVE_TO_LIT_NOTALLOWED_NODATA
    Cause: During a loop in an internal table, an attempt was made to overwrite a reference variable that is linked with the internal table by REFERENCE INTO.
    Runtime Error: MOVE_TO_LOOP_REF
    <b>Write</b>
    Syntax Diagram
    WRITE - TO
    Syntax
    WRITE {source|(source_name)} TO destination
                                 [int_format_options].
    Effect:
    This statement assigns the formatted content of the data object source, or the formatted content of the data object whose name is contained in source_name, to the data object destination. The data objects source_name and destination must be character type and flat. source_name can contain the name of the data object to be assigned in upper or lower case. If the data object specified in source_name does not exist, the assignment is not executed, and sy-subrc is set to 4.
    The statement WRITE TO has the same effect as the statement WRITE for lists. This statement formats the content of source or the source field specified in source_name as described in the field. It does not, however, store the result in an output area of a list in the list buffer, but instead stores it in a variable. The output length is determined by the length of the variable.
    The same additions int_format_options can be specified for formatting the content as in the statement WRITE for lists, except for NO-GAP and UNDER.
    System fields
    sy-subrc Meaning
    0 The data object specified in source_name was found and the assignment was executed.
    4 The data object specified in source_name was not found and the assignment was not executed.
    For the static specification of source, sy-subrc is not set.
    Note:
    If destination is specified as an untyped field symbol or an untyped formal parameter, and is not flat and character-type when the statement is executed, this leads to an untreatable exception in a Unicode program. In non-Unicode programs, this only leads to an exception for deep types. Flat types are handled as character-type data types.
    Example:
    After the assignment, the variables date_short and date_long receive the current date in the order specified in the user master record. The variable date_long also contains the defined separators, as the output length is sufficiently long. The content of the variable date_mask is formatted according to the formatting addition DD/MM/YY.
    DATA: date_short(8) TYPE c,
          date_long(10) TYPE c,
          date_mask(8)  TYPE c.
    WRITE sy-datum TO: date_short,
                       date_long,
                       date_mask DD/MM/YY.
    Exceptions
    Non-Catchable Exceptions
    Cause: Negative length specified for offset/length
    Runtime Error: WRITE_TO_LENGTH_NEGATIVE
    Cause: Negative offset specified in offset/length
    Runtime Error: WRITE_TO_OFFSET_NEGATIVE
    Cause: Offset specified in offset/length specification is longer than the field length.
    Runtime Error: WRITE_TO_OFFSET_TOOLARGE
    Thanks
    sunil

  • I have noticed an issue with utilizing the "stream" function on iOS 7. If you choose to just stream the movie by hitting the play button it seems to actually start downloading (which is fine) but if you are say halfway thru the movie and stop you can clea

    I have noticed an issue with utilizing the “stream” function on iOS 7. If you choose to just stream the movie by hitting the play button it seems to actually start downloading (which is fine) but if you are say halfway thru the movie and stop you can clearly see that storage has been reduced under the usage, yet under the “videos” tab it still states “No Data” the only way to delete what you have partially downloaded is to fully download the video, which is fine but there is no way to tell what videos have been partially downloaded (I.e which occurs a lot when your child switches between movies using the so called “stream” function). This becomes troublesome once the capacity of the ipad is almost met and you have no way to delete this data since you may have several videos that have started to be viewed (hence partially downloaded). Apple needs to somehow make it truly streaming or provide an update so the storage can be managed. The only way I have been able to remove partially downloaded videos is by doing a total software restore. (The video data that is in question when connected to my MacBook shows up in iTunes as “other”) if you have any insight into this issue it would be greatly appreciated. Thanks.

    Here are the screenshots for what it's worth.
    Not sure why I can't post them in the original post.<br>
    <sub><b>Mod edit: See [https://bugzilla.mozilla.org/show_bug.cgi?id=718813 bug 718813]</b></sub>
    '''Again, when I set my DNS server to automatically detect the servers both problems disappear and I have no issues at all.'''
    IMO opendns is either doing this on purpose (unlikely) or they're under some sort of attack/being used to attack the specific torrent sites although I'm open to other explanations. I believe using the automatic setting for DNS is using my own ISP's DNS servers (which again, work fine... but still...)
    I'd rather not use Google's public DNS servers as Google is to commercial these days and I think there's potential privacy issues.
    '''Again I have changed the setting for DNS servers back and forth several times to duplicate/verify the issue(s)... and the issues only happen with the opendns servers.'''

  • Movies and TV Shows Missing form iPod menu -- what's up with that?

    I purchased my fist movie and TV episode last night to see how well I will like them on my iPod classic. I am connecting to the most up to date version of iTunes on my IBM/Win XP computer.
    I watched the episode (Journeyman's first episode -- missed it on Monday...it's not bad) and was pleased. Then watched Hitchhiker's Guide to the Galaxy -- also enjoyable even at the small size (especially the opening sequence which emulates "home movie" style in a very small frame).
    Near the end of the movie, my iPod battery was giving up the ghost, so I paused the movie and plugged in. After waiting out the "Do not disconnect..." syncing process the main menu finally appeared on the iPod -- but the Movie and TV Shows selections were conspicuously missing from the menu! I have not seen my Movie/TV episode since.
    They are in the iTunes library, obviously, but they simply never show up in the iPod menu. So far I have sync'd a number of times -- the sync settings were originally set by default to sync all songs, podcasts, TV Shows, Movies, Songs, etc... I tried "tweaking" these but to no avail. All syncs result in no Movie or TV Shows on the iPod menu.
    Most recently I tried deleting all material from the iPod and then re-syncing all material back to the iPod (no help) and lastly I tried resetting to factory default settings (which originally seemed to work just fine) still to no avail.
    When I select Settings >> Main Menu ... from the iPod main menu, the configuration screen also does not contain options for Movies or TV Shows.
    It all makes me say "Hmmmm...." and leaves me reluctant to waste money on video media (though thank god my Tiki TV podcasts are still coming through just fine ... no Lala? I don't think so!). Nope, check that! video podcasts are not coming through either. GEEZE!
    Has anyone experienced this before? Again, I've updated all iPod and iTunes software. Nothing "funky" seemed to happen to cause the problem, other than it conincided with plugging my iPod in (which kicks off the blasted sync process -- geeze these settings are a pain...I'd prefer the blasted thing to just sync on demand) >:-( Any help/suggestions would be most appreciated. Without a solution, I'll never be able to keep up with Journeyman!
    Thanks
    NK
    Message was edited by: NoKarma4U

    wjdavis wrote:
    I can't remember exactly what I did. I do know that when I started it up, I couldn't find the Setup Assistant on the hard drive,
    No, once a user has been created, you can't run Setup Assistant  (without erasing and reinstalling).
    What do you recommend for fixing this?
    Here's what's happened: 
    When you first start up a Mac and create the first user account, OSX assigns it UID (User ID) #501.  The next one gets #502, etc.  Those UIDs (not the user name) are what control permission to files.
    You can see those numbers via System Prefs > Users & Groups;  click the padlock and enter your Admin password, then select an account and right-click it, and select Advanced Options.  Do not change anything on that window.
    So . . . assume your old iMac had a user 501 with the data you want; it's identified that way on the backups.
    When the Apple Store started up your new Mac, and created their account, it became #501.
    When you used Migration Assistant to transfer the 501 account from the iMac's backups, OSX copied everything there "as is" except it had to change the 501 to 502. 
    The new 502 account has all the right permissions to things now in it's home folder, but the backups belong to user 501.
    Have you added much to the Mac since you did the migration?  Have you done any new backups?  If not, while it's a bit of a hassle, one fix would be to create yet another user account temporarily.  Make it an Admin account.  Log on to it and delete all the other accounts.  Then migrate the accounts from your backups; this time there won't be a conflict, so OSX won't have to change the UUID(s).
    But if you have done new backups, this won't work, since Migration Assistant automatically uses the most recent backup.  There's a way around that, but it's a bit (or more) tedious.
    Clear as mud? 

  • Error in assign statement

    Hi
    I am getting dump in following assign statement
        assign src+fields_int-offset_src(fields_int-length_src)
             to <f> type fields_int-type .
    Error description:
    The field symbol is no longer assigned because there was an attempt
    makde previously in a Unicode program to set the field symbol using
    ASSIGN with offset and/or length specification. Here, the memory   
    addressed by the offset/length specification was not within the    
    allowed area.                                                      
    Please help

    Also the dump desc is
    GETWA_NOT_ASSIGNED_RANGE

  • Dynamic Assign Statement is not working in 4.6C

    Hi Team,
    I have done the following coding to get teh dynamic value sof a field but the assign statement is failing... Its returing the sy-subrc as 4.
    LOOP AT <t_tab> INTO <s_tab>.
        LOOP AT t_flds.
          CONCATENATE '<s_tab>-' t_flds-fieldname INTO v_fldval.
          ASSIGN (v_fldval) TO <fldval>.
         endloop
       endloop.
    Appericiate your suggestions.
    Thnx,
    Ankur..

    Hi Ankur,
    I am facing the same problem.........wit no solution in hand, cud u plz let me knw if u have got some solution over this.....
    The problem occurs, maybe because the internal table field symbol <t_tab> (and hence <s_tab>) does not contain the fieldname for which u r tryin to get the value in <v_fldval>
    Is there a way to chk if a particular fieldname exists in the <t_tab>, so tht if v dont get it, we wud avoid the ASSIGN statement, so tht v dont get a dump
    Appreciate ur inputs.....
    Regards,
    Aparna.

  • Analysing  Dimensions and assigning the char

    Hello Experts,
    I have the following requirement
    Selection:Companycode,Chart of Acconts,Fiscalyear,period
    O/P: G/L account,costcenter,amount in local currency,WBS element.
    I am using standard data source 0fi_gl_4 and stadard ODS 0figl_O02 and this does'nt have Standard cube (please tell me  if it has standard cube) as i could'nt find any.
    Could any one tell me what  dimensions i need to take  and which characteristics should be assigned under specific Dim  for the above requirement. As i don't have knowledge on FIGL i am unable to analyse the things.
    i have loaded the data till ODS and now gng for creating Z cube .please do the needful in analysing the dim and assigning the char,
    Points are assured..
    Regards
    Raju

    Suri,
    Please take a look at these (in business content) as step up example, most of your chars should be included.
    G/L (New): Balance Sheet and Profit and Loss  0FIGL_V10
    G/L (New): Balance Sheet and Profit and Loss Remote  0FIGL_V11
    General Ledger (New): Transaction Figures  0FIGL_C10
    General Ledger (New): Transaction Figures Remote  0FIGL_R10
    General Ledger: Financial Statements  0FIGL_VC1
    General Ledger: Transaction Figures  0FIGL_C01
    Regards, Patrick Rieken.

  • HT201364 texmate and git 1.8.4.2 won't work on OS X Mavericks. I've downloaded them repeatedly and the following errors display "Textmate is damaged and can't be opened"  and Git states "can't be opened because it's from an unidentified developer". Please

    texmate and git 1.8.4.2 won't work on OS X Mavericks. I've downloaded them repeatedly and the following errors display "Textmate is damaged and can't be opened"  and Git states "can't be opened because it's from an unidentified developer". Please help!

    MedlockDustin,
    for TextMate, you’ll need to download TextMate 2.0 alpha, since earlier versions of TextMate aren’t supported on Mavericks. The file will be named “nightly”; save it to your desktop. Once the “nightly” file has finished downloading, rename it to “TextMate.app.tar.bz2” — that will give it the “BZ” icon on your desktop. Once it’s been renamed, you can double-click on it, and TextMate.app will appear on your desktop. Use your administrative login to move TextMate.app to your Applications folder.
    Regarding the “unidentified developer” message displayed by trying to open git 1.8.4.2, please refer to this Apple page for the workaround.

  • HT1657 Once a rented movie is downloaded do I need an Internet connection to view it?  For example can I download a movie and watch it on a flight?

    Once a rented movie is downloaded do I need an Internet connection to view it?  For example can I download a movie and watch it on a flight?

    Please be aware of the movie rental's time limitation that you have 30 days from the time of rental to watch your movie, and once you start watching it, you have 24 hours to finish watching it. You may watch it as many times as you like during those 24 hours. It may be helpful to make sure the download completes successfully before you begin watching the movie.
    Once the download is complete you can watch it without an Internet connection. However, an Internet connection to the iTunes Store is required to authorize playback or activate the 24 hours time-limit of movie rentals. This means, only during the starting of the movie. Once you have started playing the movie rental, internet connection is not required. You can play anywhere without internet connection.
    For more information on movie rentals, you can visit:
    iTunes Store: Movie rental frequently asked questions (FAQ)
    http://support.apple.com/kb/HT1657
    Note: 24 hours time limit is for United States customer only, while 48 hours for other countries.

  • Mutating table and row state - this was unexpected

    So, I learned in a class about 3 years ago to expect the following
    SQL> create table p (pk number primary key);
    Table created.
    SQL> create table c (fk number references p(pk));
    Table created.
    SQL> create or replace trigger t_insrt
      2  before insert on p
      3  for each row
      4  begin
      5   insert into c values (:new.pk);
      6  end;
      7  /
    Trigger created.
    SQL> insert into p values (1);
    insert into p values (1)
    ERROR at line 1:
    ORA-02291: integrity constraint (FORBESC.SYS_C00169150) violated - parent key
    not found
    ORA-06512: at "FORBESC.T_INSRT", line 2
    ORA-04088: error during execution of trigger 'FORBESC.T_INSRT'and so it led me to think that replicating ON MODIFY PARENT - MODIFY CHILD functionality wouldn't work in a BEFORE ROW trigger, but it does
    SQL> drop trigger t_insrt;
    Trigger dropped.
    SQL> create or replace trigger p_updt
      2  before update on p
      3  for each row
      4  begin
      5   update c
      6   set fk = :new.pk
      7   where fk = :old.pk;
      8  end;
      9  /
    Trigger created.
    SQL> insert into p values (1);
    1 row created.
    SQL> insert into c values (1);
    1 row created.
    SQL> select * from c;
            FK
             1
    SQL> update p
      2  set pk = 2
      3  where pk = 1;
    1 row updated.
    SQL> select * from c;
            FK
             2Why would the first scenario fail while the second succeeds? The update seems prone to a parent record also not existing, at least not by the BEFORE ROW trigger.
    ---=Chuck

    < mutating table and row state >
    BTW, you don't seem to have run into the mutating table error though 2 other threads today are also about it. You have a constraint violation, a different thing entirely.
    I believe the second scenario works because you're neatly avoiding the error of the first. The error "ORA-02291: integrity constraint (FORBESC.SYS_C00169150) violated" means that on insert Oracle is looking up the value you're trying to insert, not finding it, and raising an error. With the before trigger you are taking the assigned value from the insert, updating the parent to it, so that on actual insert when the check happens the value is there due to the update.
    I'm not convinced this is a good idea because any on-the-fly approach to data entry needs to be examined carefully.

Maybe you are looking for

  • Error 0x80070015 on clean install of windows 8.1 enterprise

    Hi, I am receiving and error 0x80070015 when trying to do a clean install of windows 8.1 enterprise evaluation on to a newly built PC.  I am installing from a USB stick to a brand new SSD running in ACHI mode.  Each time the installation reaches 12%

  • PDF silent printing

    Hi all i have a pdf that i generate with FOP then i want to print it in silent mode.I have try the FOAWTRenderer,PDFBox and the basic javax.print but the results are very far from the Acrobat or Foxit print. Any idea for this problem? Thanks

  • Error in Processing Inbound 850 Doc  - AIP-50547

    I am having a problem with setting up my 850 - 997 transaction. I receive the following error after placing the 850 file in the pick up location. Any one have any helpful suggestions on what could be causing this error and how to fix it. Yogendra Mac

  • Character Mode Report in 11gAS

    We have recently migrated our system from 2-tier (Forms 6i/Oracle 10g) to (Forms 10g/11gAS/11g DB) We have a lot of Character Mode reports which were developed using reports 6i earlier. These reports were printed on Dot Matrix Printers or Line Printe

  • Change Data Capture on RAC

    Hi , I have to install CDC on a Solaris RAC environment having 2 nodes. I have installed on a single node database , can someone tell me if the procedure is same. Regards Kumar