INSERT using a %ROWTYPE variable

In PL/SQL I need to "copy" a row in a table, changing the sequence number in a key and changing a couple of other columns. Most of the 20 or so columns are unchanged. I declare a variable using %ROWTYPE, to hold the entire row, and do a SELECT into it. Then I change the 3 columns, and want to do an INSERT, using the %ROWTYPE variable. But it seems that INSERT does not let me do this - I have to specify all the columns individually. This is tedious, and also means I have to know all the columns, which is bad for maintenance (new columns added in the future). Is there a way to INSERT the entire row? Whay does Oracle not allow this?
Dave E. at McGill Univ.

Oracle will allow this....but in Oracle9i and after. Right now you cannot do this in Oracle8i or less.
Gio
null

Similar Messages

  • Insert into multiple tables using a page variable

    Hi Guys,
    I was going to trawl the PL/SQL forum for this but as I need to use a page variable I thought I would try here first.
    I have 4 tables 2 live and 2 archive, company_table, company_table_arch, product, product_arch the tables are set up with a company Id as the join.
    you can have multiple products to a company.
    what I want to do is have an archive button on a form that will select the current record on the company table, and insert it into archive then select all records with that id in the product table and insert them into the product_arch table.
    I was thinking about doing this as a couple of page proccess, sound about right?
    the other option was using a package,
    is it possible to use page variables in a package? If so what is the sintax
    cheers
    Bjorn

    OK, I have got the basis of this working I press the archive button and the records update as per the code.
    I have one problem however.
    The button is on a form. and if the user updates the form then presses the archive button it copies the data before the table is updated (the table is updated using a save button).
    One way round this would be to jump to an "are you sure?" page
    Does anyone know a better way of doing this?
    cheers
    Bjorn

  • Inserting text from a variable in actionscript

    what is it called when you insert text from a variable in actionscript?

    Your question is not clear.  There is no specific name for the process of inserting text from a variable that I am aware of.
    If you have a dynamic textfield that you have assigned an instance name to, let's say you named it "tField", then to assign a variable called "aVar" to that textfield you would use:
    tField.text = aVar;

  • How to insert a table with variable rows in smart form

    Hi all,
    How to insert a table with variable rows in smart form?
    Any help would be appreciated.
    Regards,
    Mahesh.

    Hi,
    Right click the mouse->create->table
    If you want 5 columns, you need to declare 5 cells in one line type of the table
    Click on Table -> Details, then do the following
    Line Type 1 2 3 4 5
    L1 2mm 3mm etc
    Here specify the width of the columns as many as you want..
    then in the header/main area of the table, click create Table Line, Rowtype is L1, automatically 5 cells will come,In each cell create a text element, display the variable to be printed there.

  • Using a java variable in jsp-Reports?

    Hello everyone,
    is it possible to use a java variable in the xml-definition of a report? Something like
    <%@ taglib uri="/WEB-INF/lib/reports_tld.jar" prefix="rw" %>
    <% String someSqlStatement="select * from emp"; %>
    <rw:report id="myReport">
    <rw:objects id="myObjects">
    <report DTDVersion="9000010" name="myReport">
    <data>
    <dataSource name="Q_1">
    <select>
    <![CDATA[
    <%= someSQLStatement %>
    ]]>
    </select>
    It won't work that way (as the string is not evaluated and inserted into the definition, but how could it be done? Would be great to modify the report programatically that way? Any ideas?
    TIA,
    Marcel Jantz

    To pass values to Reports, you should use the "parameters" attribute in the <rw:report> tag. In the above case you would have:
    <% String myParameters="p_someSqlStatement=select%20*%20from%20emp"; %>
    <rw:report id="myReport" parameters="<%= myParameters %>">
    <rw:objects id="myObjects">
    <report DTDVersion="9000010" name="myReport">
    <data>
    <dataSource name="Q_1">
    <select>
    <![CDATA[ &p_someSqlStatement ]]>
    </select>
    The body of the <rw:objects> tag isn't evaluated since the Reports Builder needs to be able to open and load the <rw:objects> tag. As the Reports builder doesn't run the .jsp on open, it only parses it, the <rw:objects> tag can't have values that need to be evaluated.

  • Using Oracle package variables in JDBC.

    Can anybody know how we can use Oracle Package variable in Java/JDBC?
    I am using a insert trigger on a table which will initialize the login user
    from a package variable.In my log4j configuration file, while inserting data into this table, I am updating the user with my current user. But the insert statement is not identifying the user and it is inserting null.
    PLease let me know.

    Siva,
    You said:
    It is not inserting the user in the tableI see no table, here. Only a variable in a PL/SQL package.
    You also said:
    But the same is working in Oracle.Do you mean in SQL*Plus?
    Siva, try to forget how you are doing it, and tell me what you are trying to do.
    Do you have some UPDATE_USER column in your database tables where you record the username of the person who did the operation?
    Are you trying to write a trigger that populates this column?
    If so, then all you need is something like:
    create or replace trigger MY_TRIG
      after insert or update
      on MY_TABLE
      for each row
    begin
      :new.UPDATE_USER := user;
    end;Good Luck,
    Avi.
    P.S. By the way, what has this to do with OC4J?

  • Access fields in a Rowtype variable

    Hello!
    Is it possible to access dynamically to the fields of a rowtype variable?
    For example, I have the following code :
    CURSOR cursorName IS
    SELECT field1, field2,field3, ..., fieldN FROM myTable;
    myVar cursorName%ROWTYPE;
    myString := myVar.field1 || ';' || myVar.field2 || ... || myVar.fieldN;
    Is it possible tu use a collection such as :
    For each field IN myVar
    myString := myString || field;
    Next
    Many thanks for your answers!

    If the class you specify in the .NET adapter has public properties or fields then it should let you do "Get Property". Make sure the fields are really public and that you have the right class specified for the objects you are accessing.
    Basically, if you are storing the objects in a teststand object array, then the elements of the teststand object array are already the same as the elements of the dotnet array. You can just loop based on the number of items in the array and make calls by specifying Locals.myarray[Locals.i] as the class object (for example) when you specify the .NET step inside the loop. Be sure to uncheck the "Create object" checkbox as you want to use the object you are specifying by expression rather than creating a new one.
    Hope this helps,
    -Doug

  • How to insert, as an input variable within formula, the total time window on scope?

    How to insert, as an input variable within formula, the total time window on scope (i.e. 20ms/div x 10 div = 200ms)?
    BELOW IS AN EXAMPLE OF ISSUE:
    FORMULA FOR ACTION INTEGRAL:
    STATISTICS:
    Input variable: DPO4034(CH1);
    Check Box: number of samples.
    FORMULA
    Input variable 0: DPO4034(CH1); alias: x0
    Input variable 1: "Total Time Window on Scope???"; alias: x1
    Input variable 2: Number of Samples (CH1); alias: x2
    Under Operation Setup: Formula
    Y= (x0^2)*(x1/x2)
    Output: Processed Data 1 (CH1)
    THEN USING STATISTICS:
    Input signal: Processed Data 1 (CH1)
    Check Box: SUM
    Output: CH1 Action Integral [A^2s]
    Solved!
    Go to Solution.

    Hi again Catherine,
    I have now added another TekScope (TDS3032B) along with the DPO4034 and run the same work-around on the TDS3032B using CH1 as the "real" signal channel and CH2 as the "burst width" channel. However, the value returned for CH2 is nominally 99E+36 (min 99E+36, max 99E+36) with very few retrievals of correct burst width (~200ms). Seems the SignalExpress program is unable to consistently retrieve from TDS3032B the actual burst width (scope's time scale/window) and defaults to 99E+36 value. Any ideas on what is occurring and how to make it work? Attached are some screen captures to help guide discussion.
    Regards,
    Michael
    Attachments:
    TDS3032B - incorrect burst width.png ‏301 KB
    TDS3032B - correct burst width.png ‏287 KB
    DPO4034 - always correct burst width.png ‏302 KB

  • Issue with use of shared variables in Crystal Reports 2008 Offline Viewer

    Hi,
    I have a report that contains a number of sub-reports which include drill-down functionality. The report returns data relating to an individual team with the user being able to view top level summary information in each area from the parent report and then drill into the sub-reports to view see more detail. The data returned by the sub-reports is filtered, using sub-report links, based on the team code parameter value given by the user. This parameter field resides in the main report.
    One of the values returned by the main report is the team name. This is passed to each sub-report using a shared variable and each sub-report displays this team name as part of a heading.
    This all works fine in Crystal Reports 2008, but when a report, containing data, is opened using Crystal 2008 Offline Viewer there is a problem with the shared variable. The value is displayed correctly when the user initially drills into the sub-report. However, when the user begins to drill into grouped data within the sub-report the value passed to the sub-report using the shared variable disappears. 
    How can I ensure that, when a report is viewed using Crystal Offline Viewer 2008, the value within the shared variable is not lost when users drill into grouped data within sub-reports
    Thanks
    Stuart

    Please re-post if this is still an issue or purchase a case and have a dedicated support engineer work with you directly:
    http://store.businessobjects.com/store/bobjamer/DisplayProductByTypePage&parentCategoryID=&categoryID=11522300?resid=-Z5tUwoHAiwAAA8@NLgAAAAS&rests=1254701640551

  • Use of global variables like g_cnt_transactions_transferred in the LSMW

    Hi SapAll.
    when i had a look at the some of the LSMW's whic use IDOC as the object of uploading data into SAP from external Files i have found in the coding under the step "Maintain Field Mapping and Conversion Rules" that they use some of the global variables like below
    .if p_trfcpt = yes or sy-saprl >= '46A'.
      EDI_DC40-DOCNUM = g_cnt_transactions_transferred + 1.
    endif.
    .EDI_DC40-CIMTYP = g_cimtyp.
    .EDI_DC40-MESTYP = g_mestyp.
    .EDI_DC40-MESCOD = g_mescod.
    .if p_filept = yes.
      EDI_DC40-SNDPOR = g_fileport.
    elseif p_trfcpt = yes.
      EDI_DC40-SNDPOR = g_trfcport.
    endif.
    my doubt is where i can find these variables 'g_cnt_transactions_transferred ','g_cimtyp','g_mescod','g_fileport','g_trfcport' in the LSMW and what is the use of the variable  'g_cnt_transactions_transferred ' in the LSMW.
    I have treid to find out the above listed variables looking in step 'Maintain Field Mapping and Conversion Rules' under global variabels list and the other lists also but i couldnt found.
    can any one help me in this ?
    regards.
    Seetha.

    Hi Seetha,
               In the LSMW Workbench go to the option user menu.  And check the option display conversion program.
    Now when you execute with the radio button on dislplay conversion program, you ll see the code that got generated in the background while you built your LSMW.
    The global variables that you have mentioned are bound to be there in this program generated in the background..
    You can put a break point here and see for yourself what the value of these global variables are at runtime.
    File port, TRFC port , no. of transactions executed by one run of the LMSW Idoc program , message type are some of the fields that you have asked for .
    Regards,
    Arun

  • How do I use an array variable in the assignment target?

    Hi,
    I am creating a BPEL process in which I have to use an array variable. The array variable needs to be initialized based on some condition.
    The issue is I cannot find a way to set the value of the array variable. There are ways to GET the value of an array variable indexing into it.
    But how do I set the value by using the Array variable in the <to> tag?
    Any help is appreciated. I am using BPEL 10.1.2.0.2.
    Thanks.

    You can declare a variable of type integer which will server as your index. Figure out based on some condition in your process which index of array to update. Assign to your integer variable you created.
    And have Assign copy operation like this -
    <copy>
    <from variable="Var_Output_FetchDueDate"
    part="OutputParameters"
    query="/ns18:OutputParameters/ns18:DUEDATE"/>
    <to variable="outputVariable" part="payload"
    query="/client:GetCustomerAccountInformationProcessResponse/client:customer/client:accounts/client:account[$Var_Counter]/client:dueDate"/>
    </copy>
    I have been using this in my processes.

  • Use of OLAP variable 0FYTCFP in extracting GL transaction figures

    Hi
    We load data to cube 0FIGL_C01.
    We use the OLAP variable to ensure that we are extracting for the current fiscal year to date, as a full load, with a deletion of overlapping requests in the process chain.
    Our fiscal year ends 30 June. My question is around  special periods and opening of the new fiscal year while posting is still allowed into the old year e.g. on 15 July both the old year and the new year are open as the year end processing is still underway, and special periods 13-16 might also be in use.
    Do I have to wait until the user close the year (a manual step) to then do a "final" run for the year, with the periods specified manually, or is there a way to automate this?
    thanks and regards, Lara

    Hi Sander
    Thanks for the response.
    That;s what I have been doing (run manually after the period is closed). It is not ideal, in my mind, because it (1) relies on someone remembering to do it and (2) has to be done repetitively i.e.at least daily until the "old" period is closed, otherwise reports based on the provider will not be accurate. Again, not hard to do, just a pain when everything else is automated.
    This particular DataSource is not delta enabled, otherwise I would have used the delta loads.
    regards, Lara

  • How can I use Server level variables in a business model based report

    hi gems..
    I have declared one server level variable in the BI Analytics repository.
    Now I have made one business model based report.
    In one column I want to use that server level varible.
    I go to the formula tab of that column and then clicked on variable--> session --> put the name of the variable and click ok.
    But when i viewed the report, it is not showing the dates, rather it is showing the date format I chosed i.e DD-MMM-YYYY.
    please help..

    actually the previous problem got resolved...
    Now when I am trying to apply a filter on a particular column using that server variable, then it is showing that the varible has no value definition.
    I have clicked on the filter tab of that column-->add-->variables-->session variables-->then I put the name of the variable-->click OK.
    the following error is comming-
    Error Codes: YQCO4T56:OPR4ONWY:U9IM8TAC:OI2DL65P
    Odbc driver returned an error (SQLExecDirectW).
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 23005] The repository variable, Variable_name, has no value definition. (HY000)
    I have made that server variable from manage-->variables-->(right click) create new initialisation block-->gave the name and wrote the query and aslo gave the connection pool name and test that and it worked fine..

  • To use two presentation variables based on the period selection in OBIEE

    Dear All,
    I have period prompt in my report, based on the period prompt selection in my report I need to get the start and end dates of the period and apply in the report filter.
    For e.g. Period Name selected in the prompt is "2010 - Q1" (For this Period, Period Start Date = 01/01/2010 and Period End Date is 30/03/2010, which is not going to be displayed in the prompts).
    How can I get the start and end dates of the period into my report filter. I tried using the presentation variable for the period name, but unable to resolve the requirement.
    Your help is highly appreciated.
    Best Regards,
    Rajesh

    Hi Rajesh,
    Create a report A which will give you the period start date and end date and filter it using the period prompt.
    Then filter the main report using the report A start date and end date, using Filter -> Advanced ->Filter based on results of another request .
    Add the report A in separate section on the dashboard along with main report and hide report A section.
    Thanks,
    Vino

  • How to use the bind variable in custom.pll

    Hi,
    How to use the bind variable in custom.pll.Its through error.
    any one gem me.
    very urgent.
    M.Soundrapandian.

    Hello,
    Please, ask this kind of questions in the e-business forum.
    Francois

Maybe you are looking for

  • Document stacker has Disappeared.

    I did something! It is not in trash. When I also tried to move my Apps to the Dock. "poof" cloud of smoke and disappeared off Finder. What the heck is going on? Any help?

  • How can I choose the photo I like to set as the icon?

    Hi, is there a way that allows me to choose the photo I like to set as the icon for an album (I mean the little square on the left side of the album's name)in Photos? Thanks.

  • Alarms don't work and can't subscribe to shared calendars

    I have just discovered that my alarms do not work, and I am not able to subscribe to shared calendars. Re alarms - I have tried trashing iCal, downloading and re-installing it, trashing preferences, to no avail. Re shared calendars - once I download

  • Photoshop elements 11 organizer install fails

    I have a new windows 8 install and installed Elements 11. During import of my photo's the process stopped and my complete computer froze. After reboot Elements organizer crashes after startup. I do see the GUI flashing for 1 sec and then it crashes.

  • Flash player on a htc 8x . windows device can not get to work

    need help with installation. Some games I want to play for example on Facebook . Require adobe flashayer I go to download and nothing happens. On adobe site even again nothing happens . Tried to pull up device capatibility list for mobile devices did