Results 1 to 2 of 2

Thread: SQL question

  1. #1
    Join Date
    Jan 2002

    Unanswered: SQL question

    Hi - I'm running an example from a book using Java with databases. In the example I'm running, you need to run an SQL script on the database,
    unfortunately a script for mySQL was not avaiable. I don't know mySQL inside out, and I would really appreciate it if some Oracle/DB2 guru on here helped me...converting one of these scripts below to conform with mySQL. It seems like all I need to do is replace some keywords; My SQL loader for mySQL chokes when it encounters syscat or sys.all_constraints from from Oracle SQL. Any help would be appreciated.

    This is what it looks like as an Oracle SQL script

    select c.table_name child_table,
    c.column_name child_column,
    p.table_name parent_table,
    p.column_name parent_column
    from sys.all_constraints l,
    sys.all_cons_columns c,
    sys.all_cons_columns p
    where l.constraint_type = 'R'
    and l.constraint_name = c.constraint_name
    and l.r_constraint_name = p.constraint_name
    and l.owner = c.owner
    and l.r_owner = p.owner
    and c.position = p.position

    select c.tabname child_table,
    c.colname child_column,
    p.tabname parent_table,
    p.colname parent_column
    from syscat.references l,
    syscat.keycoluse c,
    syscat.keycoluse p
    where l.constname = c.constname
    and l.refkeyname = p.constname
    and l.tabschema = c.tabschema
    and l.reftabschema = p.tabschema
    and c.colseq = p.colseq

  2. #2
    Join Date
    Mar 2001
    Lexington, KY
    It looks like you are trying to extract some sort of referential integrity information. MySQL does not support referential integrity so I don't think any linkage information will exist.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts