I have a question about a query statement.
I like the statement to display the following:
the query needs to get all columns from the current table
with some facts like (data length, datatype,does the column have a constraint and if it has to which table)
I already have the statement in oracle:
String query = "SELECT distinct data_type, data_length
, uc.constraint_type, substr(uc.r_constraint_name, 4) as foreigntabel
, column_id
FROM
(
user_tab_columns utc
LEFT OUTER JOIN user_cons_columns ucc ON ucc.column_name = utc.column_name
And
ucc.table_name = utc.table_name
and
ucc.CONSTRAINT_NAME
in (
select constraint_name
from
user_constraints
where constraint_type
in ('C','P','R')
)
)
LEFT OUTER JOIN user_constraints uc
ON uc.constraint_name = ucc.constraint_name
WHERE utc.table_name = UPPER('"+tableName+"')
ORDER BY column_id asc, constraint_type asc";
can someone help me to rewrite the statement to MYSQL?
thanx in advanced
with kind regards Lytheon
I like the statement to display the following:
the query needs to get all columns from the current table
with some facts like (data length, datatype,does the column have a constraint and if it has to which table)
I already have the statement in oracle:
String query = "SELECT distinct data_type, data_length
, uc.constraint_type, substr(uc.r_constraint_name, 4) as foreigntabel
, column_id
FROM
(
user_tab_columns utc
LEFT OUTER JOIN user_cons_columns ucc ON ucc.column_name = utc.column_name
And
ucc.table_name = utc.table_name
and
ucc.CONSTRAINT_NAME
in (
select constraint_name
from
user_constraints
where constraint_type
in ('C','P','R')
)
)
LEFT OUTER JOIN user_constraints uc
ON uc.constraint_name = ucc.constraint_name
WHERE utc.table_name = UPPER('"+tableName+"')
ORDER BY column_id asc, constraint_type asc";
can someone help me to rewrite the statement to MYSQL?
thanx in advanced
with kind regards Lytheon