Can't insert recors fetched by cursor in the table

HI
i am fetching records from my table total_budget.All the fetched records are displayed in a tabular data block(data block name is forecast_result).Now i want to insert these record fetched by cursor in my table forecast_resul which is empty.how can i do it.I am sending the code if any one can help............
When i execute this code it give me error unable to insert(FRM-40508) .I have carefully checked table columns names and their data types.All r fine but i dont know y it is not working.Here is the code
DECLARE
cursor c1 IS
SELECT ministry_id,fiscal_year ,t_amount
FROM total_budget
WHERE ministry_id=:global.var11 AND (fiscal_year BETWEEN :syear and :eyear);
BEGIN
T_XSUMX := 0;
     OPEN C1;
     X:=1;
     SUMX := 0; SUMY := 0; SUMXY:=0; SUMX2 := 0;
     go_block('forecast_result');
     first_record;
     LOOP
          FETCH C1 INTO Y1,Y2,Y;
          EXIT WHEN C1%NOTFOUND;
          SUMY := SUMY +Y;
          XY := X*Y;
          X2 := X*X;
          SUMX := SUMX + X;
SUMXY := SUMXY + XY;
          SUMX2 := SUMX2 + X2;
               :forecast_result.ministry_id:=Y1;
               :forecast_result.fiscal_year:=Y2;
          :forecast_result.t_amount:=Y;
     NEXT_RECORD;
          X := X + 1;
     END LOOP;
     close C1;
z:=X-2;
     X_BAR := z;
     X := z+1;
     T_XSUMX := X * SUMX;
     T_SUMY := SUMY * SUMX;
     T_SUMX := SUMX * SUMX;
     T_SUMXY := SUMXY * X;
     T_SUMX2 := SUMX2 * X;
     R1 := T_SUMY - T_SUMXY;
     R2 := T_SUMX - T_SUMX2;
     B := ROUND(R1/R2,1);
     A := ROUND((T_SUMXY -(T_SUMX2*B))/T_XSUMX,1);
     Y_BAR := A+(B*X_BAR);
:forecast_result.ministry_id:=Y1;
:forecast_result.fiscal_year:=Y2;
:forecast_result.t_amount:=Y_BAR;
next_record;
     insert into forecast_result
     values(:forecast_result.ministry_id,:forecast_result.fiscal_year,:forecast_result.t_amount);
     commit;
END;
Can anyone tell me wat i am doing wrong
looking for instant reply
nida

Hi alma,
Plz u dnt wrt babytalk rr SMS-language -> mi! Becoz mi don lejk dat.
I suppose that your data block "forecast_result" are based on the table of the same name. Otherwise this may be the cause of some of your trouble.
Your code would properly work better like this:
DECLARE
  X NUMBER(38);
  SUMX NUMBER(38);
  SUMY NUMBER(38);
  Y NUMBER(38) ;
  Y1 varchar2(10);
  Y2 varchar2(10);
  X2 NUMBER(38);
  XY NUMBER(38);
  SUMXY NUMBER(38);
  SUMX2 NUMBER(38);
  X_BAR NUMBER(38);
  Y_BAR NUMBER(38);
  T_SUMY NUMBER(38);
  T_SUMX NUMBER(38);
  T_SUMXY NUMBER(38);
  T_SUMX2 NUMBER(38);
  T_XSUMX NUMBER(38);
  R1 NUMBER(38);
  R2 NUMBER(38);
  A NUMBER(38);
  z number(38);
  B NUMBER(38);
  final number(38);
  -- Just curious, where does :syear and :eyear come from ??
  cursor c1 IS
   SELECT ministry_id, fiscal_year, t_amount
    FROM total_budget
   WHERE ministry_id=:global.var11
     AND (fiscal_year BETWEEN :syear and :eyear);
BEGIN
  T_XSUMX := 0;
  X:=1;
  SUMX := 0;
  SUMY := 0;
  SUMXY:=0;
  SUMX2 := 0;
  go_block('forecast_result');
  -- If you're making this dynamically, then clear the block to start with.
  clear_block(NO_COMMIT);
  first_record;
  OPEN C1;
  LOOP
    FETCH C1 INTO Y1, Y2, Y;
    EXIT WHEN C1%NOTFOUND;
    SUMY := SUMY + Y;
    XY := X*Y;
    X2 := X*X;
    SUMX := SUMX + X;
    SUMXY := SUMXY + XY;
    SUMX2 := SUMX2 + X2;
    :forecast_result.ministry_id := Y1;
    :forecast_result.fiscal_year := Y2;
    :forecast_result.t_amount := Y;
    -- NO, this will not work. You have to CREATE the record. You only get the
    -- first record for "free". Next_Record moves to allready existing records.
    -- NEXT_RECORD;
    Create_Record;
    X := X + 1;
  END LOOP;
  close C1;
  z := X - 2;
  X_BAR := z;
  X := z + 1;
  T_XSUMX := X * SUMX;
  T_SUMY := SUMY * SUMX;
  T_SUMX := SUMX * SUMX;
  T_SUMXY := SUMXY * X;
  T_SUMX2 := SUMX2 * X;
  R1 := T_SUMY - T_SUMXY;
  R2 := T_SUMX - T_SUMX2;
  B := ROUND(R1/R2,1);
  A := ROUND((T_SUMXY -(T_SUMX2*B))/T_XSUMX,1);
  Y_BAR := A+(B*X_BAR);
  -- What are you doing here ?? This is weird. The population of the records are done in
  -- the loop ! You don't have to add anything here.
  -- :forecast_result.ministry_id:=Y1;
  -- :forecast_result.fiscal_year:=Y2;
  -- :forecast_result.t_amount:=Y_BAR;
  -- Since your data block (hopefully) are based on the table of the same name, you DON'T
  -- need to do this. You just have to press the commit button (or F10 or the floppy disk
  -- icon or what-ever).
  -- insert into forecast_result
  -- values(:forecast_result.ministry_id,:forecast_result.fiscal_year,:forecast_result.t_amount);
  -- commit;
END;

Similar Messages

  • Can we create cursor using the table created dynamically

    Dear all,
    Can we create the cursor using the table which is created dynamically using "Execute immediate" within the same procedure,
    or is there any way to call the table created dynamically ..
    please Do Help me in this
    thanks alot
    Edited by: khaja on Jan 18, 2009 10:57 AM

    Well, I don't think this approach is bad in any possible circumstances. It depends on the requirements we don't know. Yes, usually applications should not be designed in this way. But 'usually' does not mean 'never'. One possible case is described in Oracle's example Referencing Database Objects that Do Not Exist at Compilation. It's possible to assume that tables inv_01_2003, inv_04_2003, etc from the referenced topic What Is Dynamic SQL? are generated automatically by some job using dynamic create table stmt. If the OP has similar requirements tnen this approach is not bad. It may not be the best one but it at least is not so bad as you said.
    I believe that OPs know their requirements much better than me. This is why I always try to answer the exact question. If the approach is really ugly then I don't answer such questions at all.
    Regards,
    Dima
    Message was edited by:
    DimaCit

  • While Creating New Insert Form Existing Data Display from the Table

    Hi
    I am New To Sun Java Studio Creator and New to Java Also While Creating New Insert Form Existing Data Display from the Table while i am Run the Form. Can any one help me to Solve this one

    Dear Giri,
    As per your Advise, Literally I have Search the Properties for the Components to set value Null, but I am Unable to find the Value in Properties palate. I have tried in various options like
    In the Properties Palate
    TextField1_onselect use Value null
    TextField1_text I have selected use Value option and I have manually Keyed-in null;
    In the JSP Page, I have manually keyed in the null value below said
    <ui:textField binding="#{BI.textField2}" id="textField2" style="position: absolute; left: 240px; top: 96px" text="#{BI.bDataProvider.value['ISSUENO'] = null}"/>
    <ui:textField binding="#{BI.textField2.Value = null }" id="textField2" style="position: absolute; left: 240px; top: 96px" text="#{BI.bDataProvider.value['ISSUENO'] = null}"/>
    At last I am Failure. I am ignorant of it. Can you please help me on this where I have to set null value for the components? I will be very kind of you

  • *Urgent*How to insert data from MS SQL to the table that create at the adobe form?

    Hi,
    I'm using Adobe life cycle designer 8 to do my interactive form. I would like to ask how to insert data from MS SQL to the table that i have created in my adobe interactive form?
    I really need the information ASAP as i need to hand in my project by next week... i really appreciate any one who reply this post.
    Thanks

    Tou need to do a couple of things
    1. On the Essbase server, set up an odbc system connection to your MySQL database
    2. In the load rule , go to the file menu and select open SQL data source and in the data source put in your SQL statement . A couple of hints. Where it says Select, don't put in the word select and where it say from don't put in from. The system adds them for you. The easiest way ti enter a SQL statement is to do it all in the select area So if your SQL would normanlly say select * from mytable just enter the code as * from mytable in the select area
    The click ol/retrieve and enter in your connection info. Itshould bring data back into the load rule. Save the load rule and use it

  • How to fetch what are all the tables used in this TR no and Package name of

    Hi Friends,
    I have input of Transport Request no (E070-TRKORR).
    How to fetch what are all the tables used in this TR no and Package name of this Table.

    HI,
    FYI
    SELECT E071OBJECT_NAME, E070MDEVCLASS
    FROM E071, E070M
    WHERE TRKORR = YOU REQUEST NO.

  • HOW WE CAN DO TRIAL AND ERROR METHOD TO FIND THE TABLES AND FIELDS?

    HOW WE CAN DO TRIAL AND ERROR METHOD TO FIND THE TABLES AND FIELDS FOR ENHANCING THE AUTOMATIC SERIAL NUMBER PROFILE///

    Hi
    You can find user-exit for that. In user exit function you can use all import parameter. Set debugging in include program and you can see all import parameter.
    Regards,
    M Sajid

  • Inserting values from a cursor to a table

    Hi,
    I need to insert the values from a cursor into a table,this i the part of code which trieds to do it...i get error stating "select stmt missing"...pls help out...
    OPEN  p_cursor for V_SQLSTATEMENT;
            ---for i in p_cursor
            LOOP
              FETCH p_cursor INTO v_cursor_type;      
              insert into TEMPCHARTVALUES(HOP,AMOUNT,EFFECTIVE_FROM,EFFECTIVE_TO,CURRENCY)
                   values (v_cursor_type.PMC1_HOP_CODE,
                         v_cursor_type.PMC1_Amount,
                         v_cursor_type.PMC1_EFFECTIVE_FROM,
                         v_cursor_type.PMC1_EFFECTIVE_UPTO,
                         v_cursor_type.PMC1_CURRENCY);
                                                           --dbms_output.put_line(v_cursor_type.KEYCODE1);
              EXIT WHEN p_cursor%ROWCOUNT = v_REC_COUNT;
              end loop;

    Hi, here it is..
    create or replace
    procedure  prm_sp_charts_db (P_CURSOR OUT SYS_REFCURSOR,CHARTCode VARCHAR,tablename varchar)
    IS
    v_COUNT varchar2(200);
    v_REC_COUNT NUMBER;
    V_SQLSTATEMENT VARCHAR2(2000);
    v_cursor_type  TEMPCHARTVALUES%ROWTYPE;
        begin
         v_COUNT:='SELECT COUNT(*) FROM PRM_M_Chart_' || CHARTCode;
         execute immediate v_COUNT into v_REC_COUNT;
         V_SQLSTATEMENT := 'SELECT ';
         V_SQLSTATEMENT := V_SQLSTATEMENT || 'PMC' || CHARTCode || '_F1_CODE Keycode1,';
          open  P_CURSOR for select column_name from  user_tab_columns where table_name=tablename and column_name='PMC' || CHARTCode || '_F2_CODE';
          IF P_CURSOR%FOUND then
          V_SQLSTATEMENT := V_SQLSTATEMENT || 'PMC' || CHARTCode || '_F2_CODE Keycode2,';
          else
          V_SQLSTATEMENT := V_SQLSTATEMENT || '0,';
          END IF;
          open  P_CURSOR for select column_name from  user_tab_columns where table_name=tablename and column_name='PMC' || CHARTCode || '_F3_CODE';
          IF P_CURSOR%FOUND then
          V_SQLSTATEMENT := V_SQLSTATEMENT || 'PMC' || CHARTCode || '_F3_CODE Keycode3,';
          else
          V_SQLSTATEMENT := V_SQLSTATEMENT || '0,';
          END IF;
           open  P_CURSOR for select column_name from  user_tab_columns where table_name=tablename and column_name='PMC' || CHARTCode || '_F4_CODE';
          IF P_CURSOR%FOUND then
          V_SQLSTATEMENT := V_SQLSTATEMENT || 'PMC' || CHARTCode || '_F4_CODE Keycode4,';
          else
          V_SQLSTATEMENT := V_SQLSTATEMENT || '0,';
          END IF;
          open  P_CURSOR for select column_name from  user_tab_columns where table_name=tablename and column_name='PMC' || CHARTCode || '_F5_CODE';
          IF P_CURSOR%FOUND then
          V_SQLSTATEMENT := V_SQLSTATEMENT || 'PMC' || CHARTCode || '_F5_CODE Keycode5,';
          else
          V_SQLSTATEMENT := V_SQLSTATEMENT || '0,';
          END IF;
          --open  P_CURSOR for select column_name from  user_tab_columns where table_name=tablename and column_name='PMC' || CHARTCode || '_F6_CODE';
          IF P_CURSOR%FOUND then
          V_SQLSTATEMENT := V_SQLSTATEMENT || 'PMC' || CHARTCode || '_F6_CODE Keycode6,';
          else
          V_SQLSTATEMENT := V_SQLSTATEMENT || '0,';
          END IF;
          --open  P_CURSOR for select column_name from  user_tab_columns where table_name=tablename and column_name='PMC' || CHARTCode || '_F7_CODE';
          IF P_CURSOR%FOUND then
          V_SQLSTATEMENT := V_SQLSTATEMENT || 'PMC' || CHARTCode || '_F7_CODE Keycode7,';
          else
          V_SQLSTATEMENT := V_SQLSTATEMENT || '0,';
          END IF;
          --open  P_CURSOR for select column_name from  user_tab_columns where table_name=tablename and column_name='PMC' || CHARTCode || '_F8_CODE';
          IF P_CURSOR%FOUND then
          V_SQLSTATEMENT := V_SQLSTATEMENT || 'PMC' || CHARTCode || '_F8_CODE Keycode8,';
          else
          V_SQLSTATEMENT := V_SQLSTATEMENT || '0,';
          END IF;
          --open  P_CURSOR for select column_name from  user_tab_columns where table_name=tablename and column_name='PMC' || CHARTCode || '_F9_CODE';
          IF P_CURSOR%FOUND then
          V_SQLSTATEMENT := V_SQLSTATEMENT || 'PMC' || CHARTCode || '_F9_CODE Keycode9,';
          else
          V_SQLSTATEMENT := V_SQLSTATEMENT || '0,';
          END IF;
          --open  P_CURSOR for select column_name from  user_tab_columns where table_name=tablename and column_name='PMC' || CHARTCode || '_F10_CODE';
          IF P_CURSOR%FOUND then
          V_SQLSTATEMENT := V_SQLSTATEMENT || 'PMC' || CHARTCode || '_F10_CODE Keycode10,';
          else
          V_SQLSTATEMENT := V_SQLSTATEMENT || '0,';
          END IF;
          V_SQLSTATEMENT := V_SQLSTATEMENT ||'PMC' || CHARTCode || '_HOP_CODE HOPCode,PMC' || CHARTCode || '_AMOUNT ,PMC'|| CHARTCode || '_EFFECTIVE_FROM Effective_From,PMC' || CHARTCode || '_EFFECTIVE_UPTO Effective_Upto,PMC' || CHARTCode || '_CURRENCY Currency FROM PRM_M_CHART_' || CHARTCode ;
          DBMS_OUTPUT.PUT_LINE(V_SQLSTATEMENT);
           OPEN  p_cursor for V_SQLSTATEMENT;
            ---for i in p_cursor
            LOOP
              FETCH p_cursor INTO v_cursor_type;      
              insert into TEMPCHARTVALUES(HOP,AMOUNT,EFFECTIVE_FROM,EFFECTIVE_TO,CURRENCY)
                   values (v_cursor_type.PMC1_HOP_CODE,
                         v_cursor_type.PMC1_Amount,
                         v_cursor_type.PMC1_EFFECTIVE_FROM,
                         v_cursor_type.PMC1_EFFECTIVE_UPTO,
                         v_cursor_type.PMC1_CURRENCY);
                                                           --dbms_output.put_line(v_cursor_type.KEYCODE1);
              EXIT WHEN p_cursor%ROWCOUNT = v_REC_COUNT;
              end loop;
    end prm_sp_charts_db;

  • Can't insert schema-based xmltype into binary xmltype table

    I'm having issues trying to use binary storage along with the ALLOW ANYSCHEMA clause. I can't use the XMLSchema-instance mechanism for creating my schema-based XMLType instances, so I'm using CreateSchemaBasedXml. When I try to insert the XMLType into the table, however, it seems to think it's not schema-based and throws an error. I trimmed down my schema for the purposes of this example. Here's the schema (schematest.xsd):
    <?xml version="1.0" encoding="Windows-1252"?>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="FORMINFO">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="SUBJECT">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="ADDR">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="STREET" type="xs:string" />
                        <xs:element name="CITY" type="xs:string" />
                        <xs:element name="STATEPROV" type="xs:string" />
                        <xs:element name="ZIP" type="xs:string" />
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>Here's the instance file (schema testinst.xml):
    <?xml version="1.0" encoding="utf-8"?>
    <FORMINFO>
       <SUBJECT>
          <ADDR>
             <STREET>123 Main St</STREET>
             <CITY>Las Vegas</CITY>
             <STATEPROV>NV</STATEPROV>
             <ZIP>12345</ZIP>
          </ADDR>
       </SUBJECT>
    </FORMINFO>I registered the schema and created the test table:
    BEGIN
      DBMS_XMLSCHEMA.registerschema(
       schemaurl => 'http://localhost/schematest.xsd',
       schemadoc => bfilename('XMLDIR','schematest.xsd'),
       gentables => false,
       gentypes => false,
       csid => nls_charset_id('AL32UTF8'),
       options => DBMS_XMLSCHEMA.REGISTER_BINARYXML);
    END;
    CREATE TABLE BINARYTEST OF XMLType
    XMLTYPE STORE AS BINARY XML
    ALLOW ANYSCHEMA;But trying to insert gives me an ORA-44422 error (this is on Oracle 11.1.0.7.0 Enterprise):
    SQL> SET SERVEROUTPUT ON
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(bfilename('XMLDIR', 'schematestinst.xml'), nls_charset_id('AL32UTF8'));
      6    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
      7    xschema.SchemaValidate();
      8    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValidated());
      9
    10    INSERT INTO BINARYTEST
    11    VALUES (xschema);
    12    commit;
    13  end;
    14  /
    Schema: http://localhost/schematest.xsd Validated: 1
    declare
    ERROR at line 1:
    ORA-44422: nonschema XML disallowed for this column
    ORA-06512: at line 10You can see from my put_line statement that the XMLType object is reporting its schema URL correctly and thinks it's been validated. Changing the table to "ALLOW NONSCHEMA" allows the insert, but it inserts it as a non-schema-based document. Am I skipping a step here?
    Thanks,
    Jim

    It might be a bug, but I am not yet sure...
    See the following examples...
    c:\>C:\oracle\product\11.1.0\db_1\bin\sqlplus.exe /nolog
    SQL*Plus: Release 11.1.0.7.0 - Production on Mon Mar 23 22:14:41 2009
    Copyright (c) 1982, 2008, Oracle.  All rights reserved.
    SQL> drop user otn cascade;
    User dropped.
    SQL> create user otn identified by otn;
    User created.
    SQL> grant xdbadmin, dba to otn;
    Grant succeeded.
    SQL> conn otn/otn
    connected.
    SQL> var schemaPath varchar2(256)
    SQL> var schemaURL  varchar2(256)
    SQL>
    SQL> begin
      2    :schemaURL := 'http://localhost/schematest.xsd';
      3    :schemaPath := '/public/schematest.xsd';
      4  end;
      5  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> declare
      2    res boolean;
      3    xmlSchema xmlType := xmlType('<?xml version="1.0" encoding="Windows-1252"?>
      4  <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      5    <xs:element name="FORMINFO">
      6      <xs:complexType>
      7        <xs:sequence>
      8          <xs:element name="SUBJECT">
      9            <xs:complexType>
    10              <xs:sequence>
    11                <xs:element name="ADDR">
    12                  <xs:complexType>
    13                    <xs:sequence>
    14                      <xs:element name="STREET" type="xs:string" />
    15                      <xs:element name="CITY" type="xs:string" />
    16                      <xs:element name="STATEPROV" type="xs:string" />
    17                      <xs:element name="ZIP" type="xs:string" />
    18                    </xs:sequence>
    19                  </xs:complexType>
    20                </xs:element>
    21              </xs:sequence>
    22            </xs:complexType>
    23          </xs:element>
    24        </xs:sequence>
    25      </xs:complexType>
    26    </xs:element>
    27  </xs:schema>');
    28  begin
    29  if (dbms_xdb.existsResource(:schemaPath)) then
    30      dbms_xdb.deleteResource(:schemaPath);
    31  end if;
    32   res := dbms_xdb.createResource(:schemaPath,xmlSchema);
    33  end;
    34  /
    PL/SQL procedure successfully completed.
    SQL> commit;
    Commit complete.
    SQL> call dbms_xmlschema.deleteSchema(:schemaURL,4);
    Call completed.
    SQL> BEGIN
      2   DBMS_XMLSCHEMA.registerSchema(
      3    SCHEMAURL => :SchemaURL,
      4    SCHEMADOC => xdbURIType(:SchemaPath).getClob(),
      5    LOCAL     => FALSE, -- local
      6    GENTYPES  => FALSE, -- generate object types
      7    GENBEAN   => FALSE, -- no java beans
      8    GENTABLES => FALSE, -- generate object tables
      9    OPTIONS   => DBMS_XMLSCHEMA.REGISTER_BINARYXML,
    10    OWNER     => USER
    11   );
    12  END;
    13  /
    PL/SQL procedure successfully completed.
    SQL> commit;
    Commit complete.
    SQL> var schemaDoc  varchar2(256)
    SQL>
    SQL> begin
      2    :schemaDoc := '/public/schematest.xml';
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> ----------------------------------------------------------
    SQL>
    SQL> -- Create an XML Document in the repository
    SQL>
    SQL> ----------------------------------------------------------
    SQL>
    SQL> declare
      2    res boolean;
      3    xmlDoc xmlType := xmlType('<?xml version="1.0" encoding="utf-8"?>
      4  <FORMINFO>
      5     <SUBJECT>
      6        <ADDR>
      7           <STREET>123 Main St</STREET>
      8           <CITY>Las Vegas</CITY>
      9           <STATEPROV>NV</STATEPROV>
    10           <ZIP>12345</ZIP>
    11        </ADDR>
    12     </SUBJECT>
    13  </FORMINFO>');
    14  begin
    15  if (dbms_xdb.existsResource(:schemaDoc)) then
    16      dbms_xdb.deleteResource(:schemaDoc);
    17  end if;
    18   res := dbms_xdb.createResource(:schemaDoc,xmlDoc);
    19  end;
    20  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> ----------------------------------------------------------
    SQL>
    SQL> -- Ready to test
    SQL>
    SQL> ----------------------------------------------------------
    SQL>
    SQL> select * from tab;
    no rows selected
    SQL> CREATE TABLE BINARYTEST OF XMLType
      2  XMLTYPE STORE AS BINARY XML
      3  ALLOW ANYSCHEMA;
    Table created.
    SQL> set long 100000
    SQL> select dbms_metadata.get_ddl('TABLE','BINARYTEST',user) from dual;
    DBMS_METADATA.GET_DDL('TABLE','BINARYTEST',USER)
      CREATE TABLE "OTN"."BINARYTEST" OF "SYS"."XMLTYPE"
    OIDINDEX  ( PCTFREE 10 INITRANS 2 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" )
    PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"
    XMLTYPE COLUMN OBJECT_VALUE STORE AS BASICFILE BINARY XML (
      TABLESPACE "USERS" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
    BUFFER_POOL DEFAULT))
    DISALLOW NONSCHEMA
    ALLOW ANYSCHEMA
    1 row selected.
    SQL> SET SERVEROUTPUT ON
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(xdbUriType(:SchemaDoc).getClob());
      6    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
      7    xschema.SchemaValidate();
      8    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValidated());
      9
    10    INSERT INTO BINARYTEST
    11    VALUES (xschema);
    12    commit;
    13  end;
    14  /
    Schema: http://localhost/schematest.xsd Validated: 1
    declare
    ERROR at line 1:
    ORA-44422: nonschema XML disallowed for this column
    ORA-06512: at line 10
    -- ORA-44421: cannot DISALLOW NONSCHEMA without a SCHEMA clause
    -- Cause: If no SCHEMA clause (explicit schema or ANYSCHEMA) was specified, nonschema data cannot be disallowed.-
    -- Action: Remove DISALLOW NONSCHEMA or add some SCHEMA clause.
    SQL> drop table binarytest;
    Table dropped.
    SQL> CREATE TABLE BINARYTEST OF XMLType
      2  XMLTYPE STORE AS BINARY XML
      3  ALLOW NONSCHEMA;
    Table created.
    SQL> select dbms_metadata.get_ddl('TABLE','BINARYTEST',user) from dual;
    DBMS_METADATA.GET_DDL('TABLE','BINARYTEST',USER)
      CREATE TABLE "OTN"."BINARYTEST" OF "SYS"."XMLTYPE"
    OIDINDEX  ( PCTFREE 10 INITRANS 2 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" )
    PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"
    XMLTYPE COLUMN OBJECT_VALUE STORE AS BASICFILE BINARY XML (
      TABLESPACE "USERS" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
    BUFFER_POOL DEFAULT))
    ALLOW NONSCHEMA
    DISALLOW ANYSCHEMA
    1 row selected.
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(xdbUriType(:SchemaDoc).getClob());
      6    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
      7    xschema.SchemaValidate();
      8    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValidated());
      9
    10    INSERT INTO BINARYTEST
    11    VALUES (xschema);
    12    commit;
    13  end;
    14  /
    Schema: http://localhost/schematest.xsd Validated: 1
    PL/SQL procedure successfully completed.
    SQL> select * from binarytest;
    SYS_NC_ROWINFO$
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    1 row selected.
    SQL> SET SERVEROUTPUT ON
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(xdbUriType(:SchemaDoc).getClob());
      6
      7    dbms_output.put_line(x.getstringval());
      8
      9    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
    10
    11    dbms_output.put_line(xschema.getstringval());
    12
    13    xschema.SchemaValidate();
    14    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValidated());
    15
    16    INSERT INTO BINARYTEST
    17    VALUES (xschema);
    18    commit;
    19  end;
    20  /
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    Schema: http://localhost/schematest.xsd Validated: 1
    PL/SQL procedure successfully completed.
    SQL> create table ORtest of xmltype
      2  xmlschema "http://localhost/schematest.xsd" element "FORMINFO"
      3  ;
    Table created.
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(xdbUriType(:SchemaDoc).getClob());
      6
      7    dbms_output.put_line(x.getstringval());
      8
      9    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
    10
    11    dbms_output.put_line(xschema.getstringval());
    12
    13    xschema.SchemaValidate();
    14    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValid());
    15
    16    INSERT INTO ORTEST
    17    VALUES (xschema);
    18    commit;
    19  end;
    20  /
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    Schema: http://localhost/schematest.xsd Validated: 1
    PL/SQL procedure successfully completed.
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(xdbUriType(:SchemaDoc).getClob());
      6
      7    dbms_output.put_line(x.getstringval());
      8
      9    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
    10
    11    dbms_output.put_line(xschema.getstringval());
    12
    13    xschema.SchemaValidate();
    14    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValid());
    15
    16    INSERT INTO BIN_ONE_SCHEMA
    17    VALUES (xschema);
    18    commit;
    19  end;
    20  /
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    Schema: http://localhost/schematest.xsd Validated: 1
    PL/SQL procedure successfully completed.
    SQL> ----------------------------------------------------------
    SQL>
    SQL> -- Create an XML Document in the repository
    SQL>
    SQL> ----------------------------------------------------------
    SQL>
    SQL> declare
      2    res boolean;
      3    xmlDoc xmlType := xmlType('<?xml version="1.0" encoding="utf-8"?>
      4  <FORMINFO>
      5     <SUBJECT>
      6        <ADDR>
      7           <STREET>123 Main St</STREET>
      8           <CITY>Las Vegas</CITY>
      9           <STATEPROV>NV</STATEPROV>
    10           <ZIP>12345</ZIP>
    11           <ONE_TO_MANY>say what?</ONE_TO_MANY>
    12        </ADDR>
    13     </SUBJECT>
    14  </FORMINFO>');
    15  begin
    16  if (dbms_xdb.existsResource(:schemaDoc)) then
    17      dbms_xdb.deleteResource(:schemaDoc);
    18  end if;
    19   res := dbms_xdb.createResource(:schemaDoc,xmlDoc);
    20  end;
    21  /
    PL/SQL procedure successfully completed.
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(xdbUriType(:SchemaDoc).getClob());
      6
      7    dbms_output.put_line(x.getstringval());
      8
      9    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
    10
    11    dbms_output.put_line(xschema.getstringval());
    12
    13    xschema.SchemaValidate();
    14    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValid());
    15
    16    INSERT INTO BIN_ONE_SCHEMA
    17    VALUES (xschema);
    18    commit;
    19  end;
    20  /
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
          <ONE_TO_MANY>say what?</ONE_TO_MANY>
        </ADDR>
    </SUBJECT>
    </FORMINFO>
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
          <ONE_TO_MANY>say what?</ONE_TO_MANY>
        </ADDR>
    </SUBJECT>
    </FORMINFO>
    declare
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00213: only 0 occurrences of particle "ADDR", minimum is 1
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at line 13
    SQL>

  • How can I inserting file's line into a oracle table in physycal order

    How can I insert the file's line into a oracle table in the same physycal order that they exists in the file ?
    I am using "SQL to FILE" km to performing file load into Oracle table, but the order which the records are insered into the oracle table doesn't match with the order of file's lines
    How can I guarantee the same file's physycal order in the oracle table( target ) and file( source ) ?
    Is it possible throught ODI ?
    Thanks,
    Luciana

    Hi,
    although I understand why use "File to Oracle( SQLLDR )" KM, I haven't the guarantee that in the agent's machine the Oracle Client installed and because when I openned the others projects I saw that anyone in my company use this KM( "File to Oracle( SQLLDR )" )
    Tha's why I ask for anyone lead me whith the modification of the previous post in the "uLKM File to SQL", specifing the km step e where put the RECNUM pseudo column
    This is fundamental for my ODI project
    When I try to alter the "Create Work Table" and "Load Data" step of my "uLKM File to SQL" km, the execution returned me the error below:
    =====================> Create Work Table Step
    create table <@= vWorkTable @>
         C1_LINHA_ARQ     VARCHAR2(500) NULL, RECNUM NUMBER(10)
    =====================> Load Data Step
    select     LINHA_ARQ     C1_LINHA_ARQ
    from      TABLE
    /*$$SNPS_START_KEYSNP$CRDWG_TABLESNP$CRTABLE_NAME=ARQ_INSS2SNP$CRLOAD_FILE=/arquivos_odi/ccrs/in/#CCRS_CAD_INSS.vpNOME_ARQUIVOSNP$CRFILE_FORMAT=DSNP$CRFILE_SEP_FIELD=09SNP$CRFILE_SEP_LINE=0D0ASNP$CRFILE_FIRST_ROW=0SNP$CRFILE_ENC_FIELD=SNP$CRFILE_DEC_SEP=SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=LINHA_ARQSNP$CRTYPE_NAME=STRINGSNP$CRORDER=1SNP$CRLINE_OFFSET=1SNP$CRLENGTH=500SNP$CRPRECISION=500SNP$CR$$SNPS_END_KEY*/
    insert into ODI_RUN_CONV.C$_0TMP_ODI_INSS_DADOS_ARQ
         C1_LINHA_ARQ, RECNUM
    values
         :C1_LINHA_ARQ, RECNUM
    =====================
    984 : 42000 : java.sql.BatchUpdateException: ORA-00984: column not allowed here
    984 : 42000 : java.sql.SQLSyntaxErrorException: ORA-00984: column not allowed here
    java.sql.BatchUpdateException: ORA-00984: column not allowed here
         at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:629)
         at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9409)
         at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:211)
         at com.sunopsis.sql.SnpsQuery.executeBatch(Unknown Source)
    ...Thanks again gyus,
    Luciana
    Edited by: 933810 on 31/05/2012 06:04
    Edited by: 933810 on 31/05/2012 06:07
    Edited by: 933810 on 31/05/2012 06:14

  • Dreamweaver: can i insert a background image in a layout table?

    i'm using a layout table and i can't figure out how to put a
    non-repeating image into the background of my layout table. is this
    possible? i need to center it too.

    Before anything else, I would say DON'T USE LAYOUT MODE.
    In my opinion, there are three serious problems with Layout
    Mode -
    1. Perhaps most importantly, it sits between you and *real*
    HTML tables,
    and fools you into believing that concepts like "layout cell"
    and
    "autostretch" really mean something. They do not. As long as
    you use
    Layout Mode, you'll never learn one of the most important
    things for new web
    developers - how to build solid and reliable tables.
    2. Actually, #1 wouldn't be *so* bad, except that the code
    that is written
    by Layout Mode is really poor code. For example, a layout
    table contains
    MANY empty rows of cells. This can contribute to a table's
    instability.
    In addition, if your initial positioning of the table's cells
    is a bit
    complex,
    Layout Mode will throw in col- and rowspans aplenty as it
    merges and splits
    cells willy-nillly to achieve the pixel-perfect layout you
    have specified.
    Again,
    this is an extremely poor method for building stable tables,
    because it
    allows
    changes in one tiny cell's shape (i.e, dimensions) to ripple
    through the
    rest
    of the table, usually with unexpected and sometimes
    disastrous consequences.
    This is one of the primary reasons for the final result's
    fragility - read
    this -
    http://apptools.com/rants/spans.php
    3. The UI for Layout Mode is beyond confusing - many options
    that you might
    want to use are inaccessible, e.g., inserting another table,
    or layer onto
    the page.
    I can understand the new user's desire to use this tool to
    make their life
    easier,
    but the cost is just too heavy in my opinion.
    To make good tables, keep it simple. Put a table on the page,
    and begin to
    load your content. If you would want a different table
    layout, instead of
    merging or splitting cells, consider stacking tables or
    nesting simple
    tables instead, respectively.
    And above all, do not try to build the whole page with a
    single table!
    Luckily, Adobe understands the problems created for the
    unsuspecting user
    who falls into this trap, and has elected to remove this
    feature altogether
    from the next version of DW. The time is right for you to
    begin working
    with tables properly!
    To read more about this approach, visit the DW FAQ link in my
    sig, and run
    through the table tutorials.
    Adobe agrees with this analysis - Layout mode is being
    removed from the next
    version of DW.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "dfgsdrsdr" <[email protected]> wrote in
    message
    news:[email protected]...
    > i'm using a layout table and i can't figure out how to
    put a non-repeating
    > image into the background of my layout table. is this
    possible? i need to
    > center it too.

  • ORA-01776: I can't insert on a view comprised by two tables

    Good morning:
    I'm trying to do an insertion on a view comprised by the join of two tables (departments and employees) and it failed.
    The view is this one:
    CREATE OR REPLACE FORCE VIEW "EMPDPTO" ("EMPLOYEE_ID", "LAST_NAME", "EMAIL", "HIRE_DATE", "JOB_ID", "DEPARTMENT_ID", "DEPARTMENT_NAME") AS
    SELECT employee_id, last_name, email, hire_date, job_id, d.department_id, department_name
    FROM employees e, departments d
    WHERE e.department_id = d.department_id
    My insertion command
    INSERT INTO empdpto
    VALUES(743, 'Bermejo', '[email protected]', '12/12/09', 'IT_PROG', 10, 'Administration');
    throws a ORA-01776: it's not possible to modify more than one base table through a join union.
    On the other side I've seen in documentation that in certain circunstances is possible to do an insertion on a complex view.
    Is it possible to do an insertion on a view comprised by two tables?. Under what circunstances?.
    Thanks

    From SQL Reference CREATE VIEW section Notes on Updatable Views http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_8004.htm#i2065510
    >
    If you want a join view to be updatable, then all of the following conditions must be true:
    The DML statement must affect only one table underlying the join.
    For an INSERT statement, the view must not be created WITH CHECK OPTION, and all columns into which values are inserted must come from a key-preserved table. A key-preserved table is one for which every primary key or unique key value in the base table is also unique in the join view.
    For an UPDATE statement, the view must not be created WITH CHECK OPTION, and all columns updated must be extracted from a key-preserved table.
    >
    The first condition is not true for the view you have created.
    Edited by: P. Forstmann on 26 janv. 2010 20:17

  • How to fetch last record from the table to display in screen painter?

    Hi Gurus,
                  I have a requirement where i have to fetch the last record value in the table.
    I have a screen where the TEXT name is REQUEST and I/P field name is REQ and SAVE push button.
    In this I/P field automatically 1 should display when i excecute the program and when i save this, the request number should turn to 2 that is dynamically..once agin save then 3 and so on....and this 1, 2, 3 will be storeing in table.
    I have succeeded till generating the values dynamically and saving in the table like 1 is displayed and when i click save it is changeing to 2..but the problem is when i am coming out of program and logon again the request number is again displaying as 1 rather it has to start with 4 because already 3 request are there in the table.
    My code is...
    Table zsave.
    data declarations....
    data req type i.
    req = 0.
    req = zsave-req.
    PROCESS BEFORE OUTPUT
    req = 0.
    select req into table fun_st from zsave.
    req = zsave-req.
    zsave-req = req.
    req = zsave-req + 1.
    PAI
    req = zsave-req + 1.
    zsave-req = req.
    when 'save'.
    wa_funst-req = zsave-req.
    Please can you provide me with the solution....answer will be rewared.
    THKS

    Can you tell me, when updaing the ZSAVE table with the counter value are you modifying the exisiting value or inserting the value as new record?
    From the code in your first post, i see that you are extracting records into internal table but when you are moving to variable REQ, you are moving from table work area which is blank, so everytime when you execute it may be starting as 0.
    Hope below code can help you understand on handling your requirement
    Global Declaration:
    >DATA: l_req TYPE i. 
    PBO:
      SELECT MAX( req ) INTO l_req FROM zsave.
      l_req = l_req + 1.
    PAI:
      DATA: wa TYPE zsave.
      CASE ucomm.
      WHEN 'SAVE'.
        wa-req = l_req.
        INSERT zsave FROM wa.
      ENDCASE.

  • HR API User Hooks - Can I use to change a value in the table the API for?

    I am trying to initialize a descriptive flexfield on per_all_people_f. I originally tried doing the initialization using a “before row insert” database trigger directly on the table per_all_people_f. Seems to work great in the People form (PERWSHRG), but does not seem to work consistently when a new employee is entered through a template like Enter Employees (PERWSQHM).
    Does anyone know if you can use an API User Hook to initialize a value on one o the tables the API is inserting? For example, could I put a "Before Process" user hook on the "Create_ Employee" API to change the value of a descriptive flexfield?
    Any other good ideas?
    Currently I have a concurrent request that runs once every 30 minutes to default the descriptive flexfield. The delay is causing issues.

    In such cases you should write the code to default the values in the front end PUIs. As one person pointed out, User hooks are provided either to validate the already entered values, or to insert/update data in some custom tables but not for updating values in the same table where data is being inserted/updated.
    BTW for your information:-
    Person form (People Enter and Maintain) does not use APIs so anything written inside the user hook would be ignored by the application when this form is used. (The reason is this is one of the oldest form in HRMS, was created even before the concept of user hook came).
    Template form PERWSQHM uses APIs, so user hook is called when this form is used to create/update the data.
    Hope this is useful.

  • How can I insert, modify and delete entries on my table control?

    Hi,
    I already have build a table control. Now I want to make manipulations on it. Therefore I have created 3 buttons, insert, modify and delete. But how can I get actions on table control.
    This is my code for the internal table:
    BEGIN OF its OCCURS 0,
    mark TYPE C VALUE ' ',
    artikel_nr TYPE ZARTIKEL-ARTIKEL_NR,
    artikel_typ TYPE ZARTIKEL-TYPE,
    bezeichnung TYPE ZARTIKEL-BEZEICHNUNG,
    preis TYPE ZARTIKEL-PREIS,
    mwst TYPE ZARTIKEL-MWST,
    END OF its.
    and this is the code which i wanted to  delete a row in my table control:
    WHEN 'DELETE'.
    LOOP AT its WHERE mark EQ 'X'.
    DELETE its WHERE mark = 'X'.
    MOVE its TO ZARTIKEL.
    ENDLOOP.
    ENDCASE.
    ENDMODULE:
    and my PBO and PAI:
    PROCESS BEFORE OUTPUT.
    LOOP AT its INTO ZARTIKEL WITH CONTROL ARTIKEL.
    ENDLOOP.
    PROCESS AFTER INPUT.
    MODULE EXIT.
    LOOP AT its.
    MODULE V1.
    ENDLOOP.
    MODULE user_command_1060.
    But if I now open my table control and mark the line that I wanted to delete, nothing happens, not on my internal table and the data even not deleted on my table ZARTIKEL. Have you an idea what I did wrong??

    Hi,
    In the attributes of table control take the SELCOL as wa_zekpo-flag
    And in the internal table and work area add a field as flag(1) TYPE c
    Refer:
    At screen logic:-
    PROCESS BEFORE OUTPUT.
      MODULE status_8002.
      LOOP WITH CONTROL po_tab.
        MODULE pass_data.
      ENDLOOP.
    PROCESS AFTER INPUT.
      MODULE user_command_8002.
      LOOP WITH CONTROL po_tab.
        MODULE modify_data.
      ENDLOOP.
      MODULE function.
    In PBO,
    MODULE status_8002 OUTPUT.
      SET PF-STATUS 'ZTG_SELTB'.
      DATA : line_count TYPE i.
      DESCRIBE TABLE it_ekpo
      LINES line_count.
      po_tab-lines = line_count + 5.
    ENDMODULE.                 " STATUS_8002  OUTPUT
    *&      Module  PASS_DATA  OUTPUT
    MODULE pass_data OUTPUT.
      READ TABLE it_ekpo into wa_ekpo INDEX po_tab-current_line.
    ENDMODULE.                 " PASS_DATA  OUTPUT
    In PAI,
    *&      Module  USER_COMMAND_8002  INPUT
    MODULE USER_COMMAND_8002 INPUT.
      OK_CODE = SY-UCOMM.
      CASE OK_CODE.
        WHEN 'BACK'.
          LEAVE TO SCREEN 8001.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_8002  INPUT
    *&      Module  MODIFY_DATA  INPUT
    MODULE DISPLAY_DATA INPUT.
      MODIFY IT_EKPO INDEX PO_TAB-CURRENT_LINE FROM WA_EKPO.
    ENDMODULE.                 " MODIFY_DATA  INPUT
    *&      Module  FUNCTION  INPUT
    MODULE FUNCTION INPUT.
      OK_CODE = SY-UCOMM.
      CASE OK_CODE.
        WHEN 'SELECT'. "<--select all records
          LOOP AT IT_EKPO INTO WA_EKPO.
            WA_EKPO-FLAG = 'X'.
            MODIFY IT_EKPO FROM WA_EKPO.
          ENDLOOP.
        WHEN 'DESEL'. "<--deselect all records
          LOOP AT IT_EKPO INTO WA_EKPO.
            WA_EKPO-FLAG = ' '.
            MODIFY IT_EKPO FROM WA_EKPO.
          ENDLOOP.
        WHEN 'DELETE'.
          DELETE FROM it_ekpo WHERE flag = 'X'.
      ENDCASE.
    ENDMODULE.                 " FUNCTION  INPUT
    Regards,
    Tarun

  • How can I Insert a Text field in a DATABASE TABLE???

    Hello at all,
    i have a database Table ZTEST with 2 columns.
    MANDT     TYPE     CLNT
    TEXT         TYPE     char     (255)
    In my internal table tab, i have a text content. I want insert this content in my database table ZTEST.
    DATA: tab TYPE TABLE OF ZTEST,
               lin TYPE ZTEST.
    lin-text = 'HELLO WORLD'
    APPEND lin TO tab.
    INSERT INTO ZTEST VALUES tab.
    Commit Work.
    Is this correct???? BECAUSE it doesnt work.
    Edited by: ETN_58 on Mar 31, 2010 10:27 AM

    Hi All,
    Here table ZTEST has two fields kunnr and text where kunnr is the key field.
            REPORT  ZATEST                                  .
           tables ztest.
          DATA: itab TYPE TABLE OF ZTEST with header line.
            itab-kunnr = '67890'.
            itab-text = 'HELLO WORLD'.
            APPEND itab.
           if sy-subrc eq 0.
               INSERT  ZTEST from table itab.
            Commit Work.
          endif.
           Check with this, its working fine.
                 Regards,
                Md Ziauddin.

Maybe you are looking for