Creating a button for inserting into a table

What I can't do, because I've never needed to, is to create in a page (where I have a Interactive report) a button that when is clicked performs a simple sql (for example an insert into a table using some page item values).
How can I do it?
Thanks

Here are some of the steps:
1) Create the button.
2) Then right click on the button name and select Create Dynamic Action
3) Give the DA a name, click next
4) On the "When" Step, Event should already be "Click" and the button name should be filled in
5) For Condition, you would have a condition for when you want the button display.  Say, if your page items have a certain range of values then display this button.  No condition means the button is always displayed.
6) For the "True Action" Step, for Action select "Execute PL/SQL Code"
    [There are other ways to do this, but this is straight-forward for me.]
7) The in the PL/SQL Code block enter say:
Begin
  INSERT INTO EMP (EMPNO, ENAME, HIREDATE)        
          VALUES (:P6_EMPNO, 'MARK1970', :P6_HIREDATE);
  COMMIT;
END;   --- You would likely make them all page item variables
8) Here the part I'm not 100% sure of.
    For "Page Items to Submit", name the page items used in YOUR QUERY -- in my example these are  P6_EMPNO,P6_HIREDATE   (Note no use of & or : or . here)
    Hmm.  Start by putting nothing in the "Page Items to Return".   If that fails, then try the same page items  P6_EMPNO,P6_HIREDATE there as well.
[ I'm too lazy to go run this down at the moment.]
9) I think that's it.
Howard

Similar Messages

  • QUERY FOR INSERT INTO  SQL TABLE

    Hi all,
    i want to insert some records into SQL table but not SAP database table. This table is only present in SQL database &
    not present in SAP database.
      i want to write a program in SAP to update the SQL table(not present in SAP database). is it possible?
       if yes, plz give me the query for inserting records into SQL table.
    Regards

    Hello,
    working on the same issue:
    Try this:
    DATA : Begin Of XY Occurs 1000,
            id(15)    TYPE C,
            Name(50)  TYPE C,
            ArtNr(50) TYPE C,
            lieferant TYPE I,
         End Of XY.
    Fill this internal Table with the SAP-Table
    START Connection to your Database
      EXEC SQL.
          Connect TO 'TEST_FH'
      ENDEXEC.
      IF SY-SUBRC EQ 0.
        EXEC SQL.
        Set Connection 'TEST_FH'     " <-- this is defines with TCode dbco
        ENDEXEC.
        IF SY-SUBRC EQ 0.
        Else.
          " OUT_Msg = '... won't connect'.
          Exit.
        EndIf.  " Else IF SY-SUBRC EQ 0
      Else.
        " OUT_Msg =  'Error at Set Connection Test_FH'.
        Exit.
      EndIf.  " IF SY-SUBRC EQ 0
    ENDE  Connection to your Database
    START Insert your table XY to an external database
        Loop AT XY.
          Try.
           EXEC SQL.
               INSERT INTO stoff
               (id, name , artnr, lieferant)
               VALUES
               ( :XY-ID,  :XY-Name, :XY-ArtNr, :XY-Lieferant )
           ENDEXEC.
           COMMIT WORK AND WAIT.     " <=== Maybe VERY important
          CATCH cx_sy_native_sql_error INTO exc_ref.
              error_text = exc_ref->get_text( ).
              Concatenate 'Table-INSERT: ' error_text Into error_text.
              MESSAGE error_text TYPE 'I'.
          ENDTRY.
        ENDLoop.     " Loop AT XY     
    END   Insert your table XY to an external database
    START: Clear Connection
        EXEC SQL.
          DISCONNECT 'TEST_FH'
        ENDEXEC.
    END : Clear Connection
    Hope it works
    Best wishes
    Frank

  • JDBC Receiver adapter Error for insert into DB2 table

    Hi all,
    I want to insert data into a DB2 table on AS400 via a Receiver JDBC adapter.
    The communication channel seems to be ok but when I try to send the message, I obtain the following message on the adapter monitoring :
    Error: TransformException error in xml processor class, rollback:
    Error processing request in sax parser: Error when executing statement for table/stored proc. 'GIK.GDT01' (structure 'Statement'): java.sql.SQLException: La table GDT01 de la bibliothèque GIK est incorrecte pour cette opération.
    Could someone help me?
    In the communication channel I have seen we can choose "native SQL String" as message protocol.
    Do you think it could be a workaround for me? if yes, could someone send me an example about it?
    thanks a lot,
    Philippe

    Hi,
    Try to remove GIK.GDT01 in table tag of your XML structure and put GDT01 alone and see.
    The solution to your problem is found on this particular link.
    http://www.websina.com/bugzero/faq/exception-as400.html
    Tell me if it works
    Best regards,
    Felix

  • Using Bulk operations for INSERT into destination table and delete from src

    Hi,
    Is there any way to expediate the process of data movement?
    I have a source set of tables (with its pk-fk relations) and a destination set of tables.
    Currently my code as of now, is pickin up the single record in cursor from the parentmost table, and then moving the data from other respecitve tables. But this is happening one by one... Is there any way I can make this take less time?
    If I use bulk insert and collections, i will not be able to use the DELETE in the same block for same source record.
    Thanks
    Regards
    Abhivyakti

    Abhivyakti
    I'm not 100% sure how your code flows from what you've stated, but generally you should try and avoid cursor FOR LOOPS and possibly BULK COLLECTING.
    I always follow the sequence in terms of design:
    1. Attempt to use bulk INSERTS, UPDATES and/or DELETES first and foremost. (include MERGE as well!)
    2. If one cannot possibly do the above then USE BULK COLLECTIONS using a combination of RETURNING INTO's and
    FORALL's.
    However, before you follow this method and if you relatively new to Oracle PL/SQL,
    share the reason you cannot follow the first method on this forum, and you're bound to find some
    help with sticking to method one!
    3. If method two is impossible, and there would have to be a seriously good reason for this, then follow the cursor FOR LOOP
    method.
    You can combine BULK COLLECTS with UPDATES and DELETES, but not with INSERTS
    bulk collect into after insert ?
    Another simple example of BULK COLLECTING
    Re: Reading multiple table type objects returned
    P;

  • Fetch data from one table and insert into two tables in desired format

    I have similar to the following data in a table and it is not normalized. The groupID is being used to group two records of similar nature.
    DECLARE @OldDoc TABLE (oldDocID INT, groupID INT, deptID INT)
    INSERT INTO @OldDoc (oldDocID, groupID) VALUES (1, NULL, 111),(2,NULL,111),(3,1,111),(4,NULL,333),(5,1,222),(6,NULL,333),(7,2,222),(8,2,333),(9,NULL,111),(10,3,222),(11,NULL,333),(12,3,444)
    I need to process the data from the above table (@OldDoc) and write into two new tables (@NewDoc and @NewDocGroup) as follows.
    oldDocID should be stored as newDocID when inserting to @NewDoc table. Only records with groupID NULL and one record (first one) per group should be considered (For example, oldDocID 5 is not considered as 3 and 5 belong to the same groupID 1) for insertion. 
    DECLARE @NewDoc TABLE (newDocID INT)
    INSERT INTO @NewDoc (newDocID) VALUES (1),(2),(3),(4),(6),(7),(9),(10),(11)
    All records from @OldDoc should be considered for insertion into @NewDocGroup table. OldDocID is inserted as NewDocID and deptID is as-is. Instead of groupID, the ID of the first record in the 
    group should be considered as parentNewDocID (For example, 3 is considered as parentNewDocID for newDocID 5 as 3 and 5 belong to the same groupID in @OldDoc table) for the newDocID.
    DECLARE @NewDocGroup (newDocID INT, parentNewDocID INT, deptID INT)
    INSERT INTO @NewDocGroup (newDocID, parentNewDocID, deptID) VALUES (1,1,111),(2,2,111),(3,3,111),(4,4,333),(5,3,222),(6,6,333),(7,7,222),(8,7,333),(9,9,111),(10,10,222),(11,11,333),(12,10,444)
    How do I accomplish the above using SQL ? Thanks for the help.

    >> I have similar to the following data in a table and it is not normalized. The group_id is being used to group two records [sic] of similar nature. <<
    Rows are not records. Tables have to have a key by definition. You do not do math with identifiers, so they should not be numeric. Let's ignore that error for now. In short, you are posting garbage. If you had followed Forum Netiquette, would you have posted
    this? 
    CREATE TABLE Old_Documents
    (old_doc_id INTEGER NOT NULL PRIMARY KEY, 
     group_id INTEGER, 
     dept_nbr INTEGER NOT NULL
       REFERENCES Departments (dept_nbr));
    INSERT INTO Old_Documents(old_doc_id, group_id, dept_nbr) 
    VALUES  (1, NULL, 111), 
    (2, NULL, 111), 
    (3, 1, 111), 
    (4, NULL, 333), 
    (5, 1, 222), 
    (6, NULL, 333), 
    (7, 2, 222), 
    (8, 2, 333), 
    (9, NULL, 111), 
    (10, 3, 222), 
    (11, NULL, 333), 
    (12, 3, 444);
    >> I need to process the data from the above table (Old_Documents) and write into two new tables (New_Documents and New_Documents_Groups) as follows. <<
    Just like punch cards and mag tape data processing! Being old and being new are a status, not another kind of entity. But that is how mag tapes work. And you even use the verb "fetch" from tape files. This design flaw is called  attribute splitting.
    Do you have a Male_Personnel and Female_Personnel table? NO! It is just Personnel! 
    >> old_doc_id should be stored as new_doc_id when inserting to New_Documents table. Only records [sic] with group_id NULL and one record [sic] (first [sic; no ordering in a table] one) per group should be considered (For example, old_doc_id 5 is not considered
    as 3 and 5 belong to the same group_id =1) for insertion. <<
    Think about your punch card mindset. Why did you physically materialize that redundant New_Documents table? Let me answer that: this is how you work with punch cards! In SQL we use a VIEW:
    CREATE VIEW New_Documents (new_doc_id)
    AS 
    SELECT old_doc_id 
      FROM Old_Documents;
    >> All records [sic] from Old_Documents should be considered for insertion into New_Documents_Groups table. The old_doc_id is inserted as new_doc_id and dept_nbr is as-is. Instead of group_id, the ID [sic: which identifier??] of the first [sic: tables
    have no ordering like a deck of punch cards] record [sic] in the group should be considered as parent_new_doc_id (For example, 3 is considered as parent_new_doc_id for new_doc_id 5 as 3 and 5 belong to the same group_id in Old_Documents table) for the new_doc_id.
    <<
    Why not use 5 as the parent? My guess is that you are trying to form equivalence classes. See:
    https://www.simple-talk.com/content/print.aspx?article=2020
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • How to insert into 2 tables from the same page (with one button  link)

    Hi,
    I have the following 2 tables....
    Employees
    emp_id number not null
    name varchar2(30) not null
    email varchar2(50)
    hire_date date
    dept_id number
    PK = emp_id
    FK = dept_id
    Notes
    note_id number not null
    added_on date not null
    added_by varchar2(30) not null
    note varchar2(4000)
    emp_id number not null
    PK = note_id
    FK = emp_id
    I want to do an insert into both tables via the application and also via the same page (with one button link). I have made a form to add an employee with an add button - adding an employee is no problem.
    Now, on the same page, I have added a html text area in another region, where the user can write a note. But how do I get the note to insert into the Notes table when the user clicks the add button?
    In other words, when the user clicks 'add', the employee information should be inserted into the Employees table and the note should be inserted into the Notes table.
    How do I go about doing this?
    Thanks.

    Hi,
    These are my After Submit Processes...
    After Submit
    30     Process Row of NOTES     Automatic Row Processing (DML)     Unconditional
    30     Process Row of EMPLOYEES     Automatic Row Processing (DML)     Unconditional
    40     reset page     Clear Cache for all Items on Pages (PageID,PageID,PageID)     Unconditional
    40     reset page     Clear Cache for all Items on Pages (PageID,PageID,PageID)     Unconditional
    40     reset page     Clear Cache for all Items on Pages (PageID,PageID,PageID)     Unconditional
    40     reset page     Clear Cache for all Items on Pages (PageID,PageID,PageID)     Unconditional
    50     Insert into Tables     PL/SQL anonymous block     Conditional
    My pl/sql code is the same as posted earlier.
    Upon inserting data into the forms and clicking the add button, I get this error...
    ORA-06550: line 1, column 102: PL/SQL: ORA-00904: "NOTES": invalid identifier ORA-06550: line 1, column 7: PL/SQL: SQL Statement ignored
         Error      Unable to process row of table EMPLOYEES.
    Is there something wrong with the pl/sql code or is it something else?

  • Looking for an insert statement to insert into a table around 500 rows

    Hi  Gurus,
    Your help is greatly appreciated !!,
    I need to have a query to insert into the mer_spec_feature table with the following , Please sugesst apart from the Utl_file ,input thing
    as the data is differnt in the regions and am lokking if it workes out with a insert and select query .
    1)I have to create a  script for inserting records into  mer_spec_feature where  on appl_id ‘VXRR’
    having feature ID 786 and have to Exclude TIDs which already have the 786 feature added for this appl_id like in the eblwo select query .
    2)There are 509 such TIDs where it doesnt have the 786 feature with appl_id -'VXRR' in the mer_spec_feature table
    3)
    select distinct terminal_id,  appl_id, from  mer_spec_feature
    where appl_id = 'VXRR'
    minus
    select distinct terminal_id, appl_id from mer_spec_feature
    where appl_id = 'VXRR'
    and terminal_feature_id = 786
    desc mer_spec_feature :
    Terminal_id  --varachr2(9)
    appl_id    --varcahr2(10 )
    terminal_feature-id --number(8)
    TERMINAL_FEATURE_ID
    TERMINAL_APPL_ID
    TERMINAL_ID
    299
    405T330a
    1004665
    786
    VXRR
    1004665

    @Frank Kulash !!
    Thanks always for your replys .!!
    i have tried with the above sql , and am having issue with the pk constraint after inserting  232 rows.
    And a Tertminal_id  will have 100 feature_id's for one  appl_id.
    becoz it has pk constraint on  -- TERMINAL_FEATURE_ID, APPL_ID, TERMINAL_ID
    TERMINAL_FEATURE_ID
    APPL_ID
    TERMINAL_ID
    299
    405T330a
    1004665
    786
    VXRR
    1004665
    can you please sugeest any other option.

  • How to Improve inserts into Template table for Query Processing

    Hi guys!
    I need your advice. How can i improve inserts into template table (/BI0/0P00000010 for exemple)? In my scenario i forced to load data from cube C_X to cubes C_1, C_2 and C_3.
    To get a goal i created a transformations and a DTP process with delta upload to each of cubes (C_1, C_2, C3). And that proccess takes about 3 hours! (it doesn't matter 1.000 or 100.000 records). But when i tried to load data with full update (with a filter) a proccess get data takes about 1 minutes.
    I traced process and saw that inserting into template table (which create each time when proccess started) take the longest time. How can i improve it?

    Hi Mahendar,
    It will require some efforts to investigate it so I propose to open a support ticket with Microsoft (through portal).
    Your first question interest me and I am not sure if you are doing proactive or reactive real time reporting. You can try with
    HBase for storing and retrieving data. HBase known for providing good read and write speed. If you are not comfortable writing HBase syntax then you can add an abstraction layer i.e. HIVE. It might take little more time when you
    query HBase from Hive.
    If you are doing real time analytic, then you can choose from Strom and Microsoft Azure Stream Analytic.
    Thanks and Regards,  
    Sudhir Rawat

  • Query for inserting into dynamic partitioned table

    i want to insert into a table which is partitioned (partition name will be obtained dynamically) based on some select statement using execute immediate statement can some one help with query

    First u create table with partition.when u will insert record it will automatically enter in right partition in dynamically.
    and when u will select that record give SELECT query with partition
    Ex:
    SELECT * FROM table_name PARTITION(partition name);

  • Inserting into a table which is created "on the fly" from a trigger

    Hello all,
    I am trying to insert into a table from a trigger in Oracle form. The table name however, is inputted by the user in am item form.
    here is what the insert looks like:
    insert into :table_name
    values (:value1, :value2);
    the problem is that forms does not recognize ::table_name. If I replace :table_name with an actual database table, it works fine. However, I need to insert to a table_name based from oracle form item.
    By the way, the table|_name is built on the fly using a procedure before I try to insert into it.
    Any suggestion on how can I do that? My code in the trigger is:
    declare
    dm_drop_tbl(:table_name,'table) // a call to an external procedure to drop the table
    dm_create_tbl(:table_name,'att1','att2');
    insert into :table_name
    values (:value1, :value2);
    this give me an error:
    encounter "" when the symbol expecting one.....

    Hi ,
    You should use the FORMS_DDL built_in procedure. Read the on-line documentation of forms ...
    Simon

  • Record not inserting into the table through Forms 10g

    Hi all,
    I have created a form in 10g(10.1.2.0.2) based on just one table that has 4 columns(col1, col2, col3, col4).
    Here col1, col2 and col3 are VARCHAR2 and col4 is date and all the columns are not null columns(There are no primary and foriegn key constrains, which means duplicates are allowed).
    My form contains 2 blocks where block 1 has one text item (col1) and 3 buttons (Delete, Save, Exit).
    And block2 is a database block and has col2,col3,col4 which are in tabluar layout frame displaying 10 records.
    When the form is opened the cursor has to be in block1.col1 for querrying. Here i enter a value in col1, and then when I click on col2 in the block2, then I put execute_query in new_block_instance of block2, which displays the records.
    The block2 properties are not updatable, insertable and query is allowed.
    Everything is working good until here. But here in the block2 when I want to insert another record into the table, by navigating all the way down to the last empty record and entering the new values for col2, col3 and col4 And then Ctrl+S will display the message "*FRM-40400: Transaction complete: 1 record applied and saved.*" But actually the record is not inserted into the table.
    I also disabled the col4 by setting the Enabled property to No, since while inserting new record the date have to be populated into it and it shouldnt be changed by the user. And im populating the sysdate into the new record by setting Intial Value property to *$$DATE$$*.
    And another requirement which I could not work arround here is that, the col3 also should be populated with the username of the user while inserting.
    please help me...

    Hi Sarah,
    I do not want to update the existing record. So I kept Udate Allowed to No in property palette for the items in block2.
    Do I have to do this property at block level also?
    I'm inserting a new record here.
    Edited by: Charan on Sep 19, 2011 8:48 AM

  • Link and insert into 2 tables

    Hi Everyone,
    I am building an application that that contains information about helpdesk calls. I am using 2 tables:
    Table 1 contains tracking info- TRK_CALLS
    ID -primary key
    USER_
    ASSIGNED_TO
    PROBLEM
    SOLUTION
    STATUS
    EDIT
    Table 2 contain date and time info - TRKCALLS_TIME
    ID - primary key
    CALL_ID - same number as ID in table 1
    DATE_
    TIME
    I have taken the advice that Denes Kubicek gave another poster and created a workspace at apex.oracle.com and places my app in there for others to look at
    workspace: kjwebb
    username: [email protected]
    password: gtmuc
    application: calltracking2
    I have a report called create/edit call tracking in there that I can either Edit or create an entry into TRK_CALLS. clicking create takes me to a form, after info is entered I have a create button that assigns the PK and inserts info into TRK_CALLS. I then have to click Edit Call Time button to input info on a form that inserts into TRKCALLS_TIME table. I would like to link these tables somehow so that when I go to the (Edit Call Time) form the Call ID is populated with the PK ID from the TRK_CALLS table.
    It would be easier to insert this info all in one page but I worked on that for a long time before giving up because I could not get anything to insert into the tables so I have taken this route.
    The basic desired outcome is to tie the tables with a PK, ID in table 1 and CALL_ID in table 2. So that they correspond and displayed on the report page.
    Please help in any way you can and make changes to my app.
    I would not be asking for help unless I have reached the ends of my apex knowledge.
    Thanks and please let me know if there are any questions,
    Kirk

    I can imagine it is pretty obscure when your knowledge of PL/SQL is not (yet) so big.
    The statement I wrote ar meant exactly for your situation.
    OK, here we go:
    First you have created a view in the Object Browser. Suppose it is called trkcalls_view .
    Then you go to SQL Workshop > SQL Commands.
    You cut the next statement and paste it in the upper white part of the screen, just under the autocommit checkbox. Replace the bold sequence references by the real name of the sequences that are used to populate the ID's of the two tables.
    You say Run and the trigger is created.
    A trigger on the view is created. Creation of such a trigger is not possible in the Object Browser, so I understand your confusion. This triggers performs when an insert in the view is performed. As you might see in the code, it creates seperate insert statements for both tables.
    CREATE OR REPLACE TRIGGER bi_trkcalls_view
    INSTEAD OF UPDATE ON trkcalls_view
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    v_id number;
    bv_id2 number;
    BEGIN
    select sequence1.nextval into v_id from dual;
    select sequence2.nextval into v_id2 from dual;
    INSERT INTO TRK_CALLS
    ( ID
    , USER_ASSIGNED_TO
    , PROBLEM
    , SOLUTION
    , STATUS
    , EDIT
    VALUES
    ( v_id
    , :new.user_assigned_to
    , :new.problem
    , :new.solution
    , :new.status
    , :new.edit
    insert into TRKCALLS_TIME
    ( id
    , call_id
    , date_time
    values
    ( v_id2
    , v_id
    , :new.date_time
    end;
    END ;good luck,
    DickDral

  • Inconsistent inserts into detail table of master-detail form

    Hello,
    [I am not sure if this is a bug or user error, so I've also put this in the bug tracking system.  Apologize for the 'duplication']
    I have a master-detail form: Orders is the master, and Order_Details is the detail. I have noticed some inconsistent behavior when inserting the detail information.
    On occasion, the row will be inserted, and a null value will get inserted into the database for the first column of the detail table; all the other data values will be inserted fine. There doesn't seem to be any pattern to when it happens. I wrote down the following test steps:
    1. Enter new order information and click 'Create'
    2. Click 'Add Row' button so can add order detail info
    3. Enter detail row information
    4. Click 'Add Row' (I do this so I can see the success message that the detail data was actually inserted)
    5. Click 'Apply Changes' at the master level.
    I ran a query on the order details table and saw that the data inserted correctly. Then I ran the following test:
    1. Enter new order information and click 'Create'
    2. Click Add Row button so can add order detail info
    3. Enter detail row information
    4. Click 'Add Row' (success message appears that detail was inserted)
    5. Enter second detail row information
    6. Click 'Add Row' (success message appears that detail was inserted, however, now in the first column of that second detail row - the product name field/column - the data does not appear. I only see my null text value. The data in the first detail row is all correct)
    7. Enter third row detail information
    8. Click 'Add Row' (success message appears that detail was inserted, and this row's information appears correctly, as does the first row's, but the second row is still showing a null value for the product name column)
    9. Click 'Apply Changes' to get out of the form
    A query of the order details table shows that a null value (-) has indeed been inserted into the table for the product name column of the second detail row.
    This behavior also happens when I don't have a null value for the LOV (i.e., it defaults to the first row of the lookup table).
    Has anyone seen this before? Am I entering the data incorrectly?
    Thanks.
    -melissa
    Message was edited by:
    mblakene

    having the some problem. Any help with this ??
    milowski were you able to solve it ? can you share the information.
    Thanks

  • How to insert into a table with a nested table which refer to another table

    Hello everybody,
    As the title of this thread might not be very understandable, I'm going to explain it :
    In a context of a library, I have an object table about Book, and an object table about Subscriber.
    In the table Subscriber, I have a nested table modeling the Loan made by the subscriber.
    And finally, this nested table refers to the Book table.
    Here the code concerning the creation of theses tables :
    Book :
    create or replace type TBook as object
    number int,
    title varchar2(50)
    Loan :
    create or replace type TLoan as object
    book ref TBook,
    loaning_date date
    create or replace type NTLoan as table of TLoan;
    Subscriber :
    create or replace type TSubscriber as object
    sub_id int,
    name varchar2(25)
    loans NTLoan
    Now, my problem is how to insert into a table of TSubscriber... I tried this query, without any success...
    insert into OSubscriber values
    *(1, 'LEVEQUE', NTLoan(*
    select TLoan(ref(b), '10/03/85') from OBook b where b.number = 1)
    Of course, there is an occurrence of book in the table OBook with the number attribute 1.
    Oracle returned me this error :
    SQL error : ORA-00936: missing expression
    00936. 00000 - "missing expression"
    Thank you for your help

    1) NUMBER is a reserved word - you can't use it as identifier:
    SQL> create or replace type TBook as object
      2  (
      3  number int,
      4  title varchar2(50)
      5  );
      6  /
    Warning: Type created with compilation errors.
    SQL> show err
    Errors for TYPE TBOOK:
    LINE/COL ERROR
    0/0      PL/SQL: Compilation unit analysis terminated
    3/1      PLS-00330: invalid use of type name or subtype name2) Subquery must be enclosed in parenthesis:
    SQL> create table OSubscriber of TSubscriber
      2  nested table loans store as loans
      3  /
    Table created.
    SQL> create table OBook of TBook
      2  /
    Table created.
    SQL> insert
      2    into OBook
      3    values(
      4           1,
      5           'No Title'
      6          )
      7  /
    1 row created.
    SQL> commit
      2  /
    Commit complete.
    SQL> insert into OSubscriber
      2    values(
      3           1,
      4           'LEVEQUE',
      5           NTLoan(
      6                  (select TLoan(ref(b),DATE '1985-10-03') from OBook b where b.num = 1)
      7                 )
      8          )
      9  /
    1 row created.
    SQL> select  *
      2    from  OSubscriber
      3  /
        SUB_ID NAME
    LOANS(BOOK, LOANING_DATE)
             1 LEVEQUE
    NTLOAN(TLOAN(000022020863025C8D48614D708DB5CD98524013DC88599E34C3D34E9B9DBA1418E49F1EB2, '03-OCT-85'))
    SQL> SY.

  • ORA-01461: can bind a LONG value only for insert into a LONG column

    Good Afternoon,
    I was just wiondering if my issue is database related rather SQL related, because my process works and the code has not been updated for sometime.
    I receive the above error when tryig to insert into a table. I running Oracle 11g.
    here is my insert command definition:
    With insCmd
    .CommandType = CommandType.Text
    .CommandText = "INSERT INTO ORIGINAL_CLAIMS VALUES (orig_claim_seq.nextval,:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,xmltype(:12),:13,:14,:15)"
    With .Parameters
    .Add(":1", OracleDbType.Int64, ParameterDirection.Input) 'BATCH_ID
    .Add(":2", OracleDbType.Varchar2, ParameterDirection.Input) 'REC_ID
    .Add(":3", OracleDbType.Varchar2, ParameterDirection.Input) 'USER_ID
    .Add(":4", OracleDbType.Varchar2, ParameterDirection.Input) 'FORM_NBR
    .Add(":5", OracleDbType.Varchar2, ParameterDirection.Input) 'PATIENT_NBR
    .Add(":6", OracleDbType.Date, ParameterDirection.Input) 'ADMIT_DATE
    .Add(":7", OracleDbType.Varchar2, ParameterDirection.Input) 'TAX_ID
    .Add(":8", OracleDbType.Varchar2, ParameterDirection.Input) 'CLAIM_TYPE
    .Add(":9", OracleDbType.Date, ParameterDirection.Input) 'SUBMIT_DATE
    .Add(":10", OracleDbType.Date, ParameterDirection.Input) 'RECEIVE_DATE
    .Add(":11", OracleDbType.Varchar2, ParameterDirection.Input) 'CLAIM_SOURCE
    .Add(":12", OracleDbType.Clob, ParameterDirection.Input) 'CLAIM_XML * XML Data
    .Add(":13", OracleDbType.Date, ParameterDirection.Input) 'LOAD_DATE
    .Add(":14", OracleDbType.Date, ParameterDirection.Input) 'UPDATE_DATE
    .Add(":15", OracleDbType.Varchar2, ParameterDirection.Input) 'DOC_NO
    End With
    .Prepare()
    End With
    Here is the insert command to insert the record:
    With insCmd.Parameters
    .Item(":1").Value = batchID
    .Item(":2").Value = RecID
    .Item(":3").Value = UserID
    .Item(":4").Value = ""
    .Item(":5").Value = PatientNbr
    .Item(":6").Value = AdmitDate
    .Item(":7").Value = Left(TaxId, 9)
    .Item(":8").Value = Left(ClaimType, 1)
    .Item(":9").Value = SubmitDate
    .Item(":10").Value = ReceiveDate
    .Item(":11").Value = ClaimSource
    .Item(":12").Value = claimNode.OuterXml
    .Item(":13").Value = Now
    .Item(":14").Value = Now
    .Item(":15").Value = docNo
    End With
    insCmd.ExecuteNonQuery()
    What is strange is that this will work for some records and not for others.
    for example, i have a batch that has 50 recs, i should have the same records in my table, only 1 record gets inserted before the error occurs.
    So in rec 2 there is something that is preventing the insert to execute.
    There is either some 'junk' in the xml or some junk data on the other 14 fiields that would cause the insert to fail.
    as i step thru the process, to me the data looks valid.
    Any insight would be appreciated,
    thanks.
    Mike

    here's the table DDL:
    CREATE TABLE CCBH_TEST.ORIGINAL_CLAIMS
    CLAIM_SEQ NUMBER(18),
    BATCH_ID NUMBER(18),
    REC_ID VARCHAR2(5 BYTE),
    USER_ID VARCHAR2(10 BYTE),
    FORM_NBR VARCHAR2(8 BYTE),
    PATIENT_NBR VARCHAR2(50 BYTE),
    ADMIT_DATE DATE,
    TAX_ID VARCHAR2(20 BYTE),
    CLAIM_TYPE VARCHAR2(1 BYTE),
    SUBMIT_DATE DATE,
    RECEIVE_DATE DATE,
    CLAIM_SOURCE VARCHAR2(120 BYTE),
    CLAIM_XML SYS.XMLTYPE,
    LOAD_DATE DATE,
    UPDATE_DATE DATE,
    DOC_NO VARCHAR2(30 BYTE)
    I got tied up in some production issues, will look at rec 2 some time next week.
    since this is a TEST environment, i'm not that worried about it, but i would like find out.
    It could be another field with 'bad' data.
    thanks,

Maybe you are looking for