Checking table columns and data type before inserting

I have some data coming from different sources and want to insert the data from those files into multiple tables.
Before inserting the data I like to perform a check on data type, length, null etc so that I can avoid errors at the time of insert. If there is any problem with the data then I do not want to perform the insert and report the problems.
Thanks

If you have 10gR2 (10.2.0.4) you could use DML_ERROR_LOGGING.
Read about it here, see the examples: http://tkyte.blogspot.com/2005/07/how-cool-is-this.html
In short: it avoids errors during your transactions, afterwards you know which records failed and why.
It's more or less the same functionality:
your goal:
check before transactions and avoid the insert of 'bad' records. (extra code, extra maintenance, more chance of bugs)
dml_err_logging:
insert 'bad' records during transaction automatically into a dedicated error table including error message.
Edited by: hoek on Mar 24, 2009 6:56 PM

Similar Messages

  • How to not make Tables, Column and Data Available in Excel

    Goal:
    Not displaying the dimension table and its data in excel
    Problem:
    I was enable to deny access for the user roles in SSAS about denying access the data from the column but the next thing is that I do not know how dimension table and column not to be available in the excel.
    Information:
    *The datasource is SSAS
    *I have made three user to have access to two tables only.

    Hi Sakura,
    According to your description, you want the Manager role can see all dimension table and its data column. And the Employee role can't view all table, column and data, right? Currently we don't have a direct option to complete hide the dimensions or attributes
    to some roles. However you can use workarounds below.
    Using cube perspectives and hide the cube dimension attribute then set the perspectives to role.
    Perspectives
    Use this workaround discussed in the similar thread below.
    Dimension attribute security to hide or unhide an attribute
    based on certain condition
    Hope this helps.
    Regards,
    Charlie Liao
    TechNet Community Support

  • How to list column names and data types for a given table using SQL

    I remember that it is possible to use a select statement to list the column names and data types of databaase tables but forgot how its done. Please help.

    You can select what you need from DBA_TAB_COLUMNS (or ALL_TAB_COLUMNS or USER_TAB_COLUMNS).

  • How can we get Dynamic columns and data with RTF Templates in BI Publisher

    How can we get Dynamic columns and data with RTf Templates.
    My requirement is :
    create table xxinv_item_pei_taginfo(item_id number,
    Organization_id number,
    item varchar2(4000),
    record_type varchar2(4000),
    record_value CLOB,
    State varchar2(4000));
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'USES','fever','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'HOW TO USE','one tablet daily','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'SIDE EFFECTS','XYZ','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'DRUG INTERACTION','ABC','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'OVERDOSE','Go and see doctor','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'NOTES','Take after meal','TX');
    select * from xxinv_item_pei_taginfo;
    Item id Org Id Item Record_type Record_value State
    493991     224     1265-D30     USES     fever     TX
    493991     224     1265-D30     HOW TO USE     one tablet daily     TX
    493991     224     1265-D30     SIDE EFFECTS     XYZ     TX
    493991     224     1265-D30     DRUG INTERACTION     ABC     TX
    493991     224     1265-D30     OVERDOSE      Go and see doctor     TX
    493991     224     1265-D30     NOTES     Take after meal     TX
    Above is my data
    I have to fetch the record_type from a lookup where I can have any of the record type, sometime USES, HOW TO USE, SIDE EFFECTS and sometimes some other set of record types
    In my report I have to get these record typpes as field name dynamically whichever is available in that lookup and record values against them.
    its a BI Publisher report.
    please suggest

    if you have data in db then you can create xml with needed structure
    and so you can create bip report
    do you have errors or .... ?

  • How do you determine a column's data type?

    Let's say I have a DB Table out there and I have NO WAY of knowing that column 1 is a CHAR, column 2 is a SMALLINT or whatever. I can write sql to select * from table and see everything, but how do I know what each column's data type is?

    I found it. Thanks, and for any other people who need the solution, here is what I found on another thread:
    int type;               try {                    type = i_metaData.getColumnType(column+1);               }               catch (SQLException e) {                    return super.getColumnClass(column);               } switch(type) {               case Types.CHAR:               case Types.VARCHAR:               case Types.LONGVARCHAR:                    return String.class;               case Types.BIT:                    return Boolean.class;               case Types.TINYINT:               case Types.SMALLINT:               case Types.INTEGER:                    return Integer.class;               case Types.BIGINT:                    return Long.class;               case Types.FLOAT:               case Types.DOUBLE:                    return Double.class;               case Types.DATE:                    return java.sql.Date.class;               case Types.TIMESTAMP: //Date Time                    return java.sql.Date.class;               case Types.DECIMAL: // Currency,Decimal                    return Float.class;               default:                    return Object.class;        } }

  • Failed to get Column's data type in Oracle 11g

    Hi,
    I made an ADO connection(Oracle provider) to Oracle 11g, and use ADO API: OpenSchema(adSchemaColumns) to fetch the columns' info. But I found I couldn't get the column's data type if it's type is timestamp or timestampwithtimezone in database. What I got is 'adIUnknown' whose number is 13.
    I test with another column whose data type is 'date', and everything is ok. I get the data type 'adDBTimeStamp'.
    This issue occurs on Oracle 10g, too.
    Can anyone offer some help? Thanks a lot!

    See
    http://www.oracle.com/technology/tech/windows/odpnet/index.html
    http://download.oracle.com/docs/cd/B28359_01/win.111/b28431/using.htm#CHDJJDAJ

  • How to Transfer Database Table Field to Data Type in XI

    Dear All,
    Dear All,
    I am working on scenario to transfer data(Database Table) from Non SAP System to SAP system through XI.
    While Defining "Data Type" in XI i want to create Data Type as of Database table in my(Oracle Database).There is any direct method to import Database Table field into "Data Type" in XI.
    thanks,
    RP

    Hi;
    Edit plus is a tool using which you can edit your file and make changes to it.
    You can download it from net ,just search for it on google.
    this will help you to get in the field names of the table by editing the file .
    Mudit

  • View Customization Table changes and Data  table base changes in a report

    Hi All,
    How to view Customization Table changes and DAta  table base changes in a report ,
    Is it right transactions: SCU3 or RSVTPROT
    Also plz let me know the concept of audit trial,
    Thanks
    SD

    Hi,
    Changes to master data objects must be captured for the For compliance purposes. The auditor allows you to be able to view and print an audit log of changes to master data objects for a chosen period. It is very common for external auditors to focus on what has changed from one year or quarter to the next to help determine the nature, extent, and population for testing. To configure and access your audit log, perform the actions listed with each of the following utilities.
    Audit Trail is used to track the record changes.
    The report RPUAUD00 gives all the changes done to the masterdata by any user anytime.
    But, before using this audit trial, please ensure that the system hardware is well equipped as the audit trials activation would later become a performance issue as this would occupy a lot of space in the coming time.
    Best Regards,
    Venkat.

  • Regarding Changing the Namespace And Data Type in XSD File

    Hi All,
    I am Doing File -
    IDOC Interface.
    I have XSD File For File Sysyetm and IDOC For ECC.
    In XSD File I Have Different Name Space And Data Type ,
    I Created the Data Type as Same as the XSD File Data type
    I Have Namespaces Are Different,
    So,I Changed the Namespace in the XSD File with the New Namespace Which I created in IR.
    I Changed in Two Places Like this
    <b><xsd:schema targetNamespace="http://Sample1.com/xi/file;" xmlns="http://Sample1.com/xi/file;"</b>
    But it is giving Error lik this
    <b>Cannot load schema with the target namespace http://xxx.com/xi/xx/vamsi/100 to namespace http://Sample1.com/xi/file;</b>
    Regards
    Vamsi

    Hi Vasanth,
    Thats what I am Asking
    I want to Import XSD File in Data Type
    Before I Import the XSD File into Data type  I changed the Namespace in the XSD to My Namespace Which is in IR. And I Created the Data Type Name in IR Which I Have in XSD FIle .
    So I Am Getting this Error
    Please Let me Know Wat to do
    Regards
    Vamsi

  • How to dump table to the flat file, if the table has NVARCHAR data type fie

    I need to dump the table to the text file. The table has NVARCHAR data type field and simple select * from table_name does not work. What do I have to do? Do I need convert NVARCHAR to VARCHAR and if yes, then how?
    Thanks,
    Oleg

    I need to dump the table to the text file. The table has NVARCHAR data type field and simple select * from table_name does not work. What do I have to do? Do I need convert NVARCHAR to VARCHAR and if yes, then how?
    Thanks,
    Oleg

  • Need query to list columns and data

    Hi all,
    I am having a requirement that to compare two identical rows based on empno and list the columns and data which columns are varied.
    SQL> select * from emp1 where empno=7369;
         EMPNO ENAME      JOB              MGR HIREDATE           SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-1980       2000                    20
          7369 SMITH      PRO             7788 17-DEC-1980       2100                    20if we see above data - columns mgr,sal and job have different data but same having same employee number
    Now i want to display the columns which are having different values for a given perticular employee having identical rows with employee number
    Note : in my original table i have 300 columns around. above explained is sample example for understanding
    thanks
    krishna.

    Hi,
    If you want a variable number of columns, depending on the data found, then you'll have to use dynamic SQL.
    I suggest you don't do that. I recommend String Aggregation , that is, concatenating the variable number of items into one big string column, formatted so that ir looks like differenct columns. That is, you might get output like this:
    EMPNO MISMATCHED_DATA
          JOB       MGR       SAL
    7369 CLERK     7902      2000
    7369 PRO       7788      2100Notice that the output consists of 3 rows and 2 columns.
    The 1st row displayed serves as a header. (The actual header has the actual, generic column name, mismatched_data.)
    Here's one way to get output like that:
    VARIABLE  data_width     NUMBER
    EXEC      :data_width := 10;
    WITH     unpivoted_data          AS
         SELECT       e.empno
         ,       DENSE_RANK () OVER ( PARTITION BY  e.empno
                                      ORDER BY          e.ROWID
                             )                    AS r_num
         ,       c.column_name
         ,       c.column_id
         ,       RPAD ( COALESCE ( CASE  c.column_name
                                        WHEN  'ENAME'       THEN  e.ename
                                    WHEN  'JOB'       THEN     e.job
                                    WHEN  'MGR'       THEN  TO_CHAR (e.mgr)
                                  WHEN  'HIREDATE'       THEN  TO_CHAR (e.hiredate, 'DD/MM/YYYY HH:MI:SS AM')
                                -- ... more columns in your real problem
                            END
                          , CASE  c.column_name
                                WHEN  'SAL'       THEN     TO_CHAR (e.sal)
                                WHEN  'COMM'         THEN  TO_CHAR (e.comm)
                                WHEN  'DEPTNO'    THEN  TO_CHAR (e.deptno)
                            END
                   , :data_width       -- maximum column width
                   )                         AS d
         FROM    emp1               e
         JOIN       user_tab_columns     c  ON     c.table_name     = 'EMP1'
         WHERE     e.empno     IN (7369)        -- any 1 or more empnos
    ,     got_val_cnt     AS
         SELECT     u.*
         ,     COUNT (DISTINCT d) OVER ( PARTITION BY  empno
                                        ,              column_name
                             )      AS val_cnt
         FROM    unpivoted_data     u
    ,     discrepancies     AS
         SELECT  v.*
         FROM     got_val_cnt     v
         WHERE     val_cnt     > 1
    ,     relevant_columns     AS
         SELECT DISTINCT  column_name
         ,           DENSE_RANK () OVER ( ORDER BY  column_id)     AS c_num
         FROM     discrepancies
    SELECT       d.empno
    ,       REPLACE ( SYS_CONNECT_BY_PATH ( NVL ( d
                                         , RPAD (' ', :data_width)
                             , '~'
                  , '~'
                ) AS mismatched_data
    FROM            discrepancies          d     PARTITION BY ( d.empno
                                              , d.r_num
    RIGHT OUTER JOIN  relevant_columns     r     ON         r.column_name = d.column_name
    WHERE     CONNECT_BY_ISLEAF     = 1
    START WITH     r.c_num          = 1
    CONNECT BY     r.c_num          = PRIOR r.c_num + 1
         AND     d.empno          = PRIOR d.empno
         AND     d.r_num          = PRIOR d.r_num
        UNION ALL
    SELECT    NULL          AS empno
    ,       REPLACE ( SYS_CONNECT_BY_PATH ( RPAD (column_name, :data_width)
                                   , '~'
                , '~'
                )     AS mismatched_data
    FROM      relevant_columns
    WHERE       CONNECT_BY_ISLEAF     = 1
    START WITH     c_num          = 1
    CONNECT BY     c_num          = PRIOR c_num + 1
    ORDER BY  empno          NULLS FIRST
    ;You can specify any number of empnos to be included in the report.
    You really want a CASE expression that has a WHEN clause for every column in your table, but CASE expressions have a maximum of (I believe) 128 WHEN clauses. If you really have 300 rows, you'll have to break that down into smaller groups. In the query above, I used 2 CASE expressions in a COALESCE function, where each of the CASE expressions had no more than 4 WHEN clauses. You may have to use 3 CASE expressions, each with 100 WHEN clauses.
    This solution does not assume there are exactly 2 rows per empno; there can be any number.
    If all the rows for an empno are completely identical, that empno will not be included in the output. This includes the situation where a given empno is unique.
    Again, you can get separate columns for each mismatched item, using dynamic SQL, but it's even more convoluted than the query above.

  • How to invoke functions and data type( ex. sflight structure ) that is in t

    Hi,experts,
    I create a funcion(zz_test) that return sflight table type data. I need to invoke the function in the Webdynpro for java application.
    I think I would import the funtion to local.
    But I don't know how to import the function and the data type using SAP NetWeaver Developer Studio?
    But I don't know how to invoke functions and data type( ex. sflight structure ) that is in the R/3 in the WDJ?
    Do you give me some hints?
    Thanks a lot!
    Best regards,
    tao

    Hi Wang Tao,
    For achieving this you need to user Adaptive RFC models.
    This link explains you on the same :
    http://help.sap.com/saphelp_nw70/helpdata/EN/6a/11f1f29526944e8580c5e59333d96d/frameset.htm
    Thanks
    Namrata

  • In XI pro, exporting PDF to Excel problem.  Excel columns and data are not properly aligned.  Help?

    I used 30 day trial of Acrobat XI and all the functions work perfectly.  But, when I buy the program (either download or disk) my PDF that export to Excel is not working.  The excel columns and data are not properly aligned as they should be.  The Trial version aligns everything perfectly.  What is happening?  I use a MAC 10.9.5.  But this shouldn't matter because the trial version works perfectly.  Can anyone help?

    just found out that this is posted in the wrong section.

  • Reciever func.module, check func.module and receiver type func

    Hi Experts,
    what is the purpose of reciever func.module, check func.module and receiver type func.module in Event Linkage.
    Give some Examples which helps.
    Thanks In Advance.

    Please check these,
    https://forums.sdn.sap.com/click.jspa?searchID=1763105&messageID=3206751
    https://forums.sdn.sap.com/click.jspa?searchID=1763105&messageID=3206440
    https://forums.sdn.sap.com/click.jspa?searchID=1763105&messageID=3207214
    https://forums.sdn.sap.com/click.jspa?searchID=1763105&messageID=3207179
    I think FM's for Processing Events should give a clear idea.
    Thanks and Regards,

  • Copying table structure and data.Please help

    Hi,
    I have a table called preview,with 100 million records in it.How can I copy the table structure and data into a table called temp_preview.
    Is it efficient to use
    create table temp_preview tablespace temp
    as select * from preview;Thanks

    Hi,
    If it is on the same database. That is the most efficient way.
    Regards
    Anurag Tibrewal.
    PS: You can try parallelism but this is not performance improvent as far as resource are concerned, it is just instead of one thread parallel thread would be working, so it just reduce the time the query takes to complete

Maybe you are looking for