Wednesday, December 11, 2013

SQLLOADER - Error Field in data file exceeds maximum length

If you do not specify length of a character column in your control file it defaults to CHAR(255).  And because of this reason most of the times you will see above error.  Whenever there is a chance that your number of characters of your column are going to be more than 255 - specify the length explicitly.

Instead of 1 below use 2:
1. load data
   APPEND
   into table t
   fields terminated by '|'
   TRAILING nullcols
   (col1,
    col2,
    col3)

2.  load data
    APPEND
    into table t
    fields terminated by '|'
    TRAILING nullcols
    (col1 CHAR(4000),
    col2,
    col3)

Monday, March 11, 2013

Query to find child tables



A simple select query to find child table of a particular table:


SELECT parent.table_name AS "PARENT TABLE", child.table_name AS "CHILD TABLE", child.R_CONSTRAINT_NAME, cols.column_name 
FROM user_constraints parent, user_constraints child, user_cons_columns cols 
WHERE parent.constraint_type = 'P' AND 
child.constraint_name = cols.constraint_name and 
parent.CONSTRAINT_NAME = child.R_CONSTRAINT_NAME AND  
child.CONSTRAINT_TYPE = 'R' AND  
parent.table_name = <table_name> 

Convert Java SQL String to Oracle SQL Format in TOAD

At times Toad might reset the capability to strip off / convert the the SQL in Java string format to SQL format. You can have that back...