|
@@ -102,35 +102,24 @@
|
|
|
AND column_type <![CDATA[ <> ]]> '-'
|
|
|
</if>
|
|
|
<if test="@org.eco.common.orm.helper.DataBaseHelper@isDmSql()">
|
|
|
- select sc.NAME column_name,
|
|
|
- (case when sc.NULLABLE$ = 'N' then '1' else null end) as is_required,
|
|
|
- (case when sc.INFO2 = 1 then '1' else '0' end) is_pk,
|
|
|
- sc.COLID sort,
|
|
|
- scc.COMMENT$ column_comment,
|
|
|
- (case when sc.INFO2 = 1 then '1' else '0' end) as is_increment,
|
|
|
- LOWER(sc.TYPE$) column_type
|
|
|
- from SYS.SYSCOLUMNS sc
|
|
|
- left join SYS.SYSOBJECTS so on sc.ID = so.ID
|
|
|
- left join SYS.SYSCOLUMNCOMMENTS SCC
|
|
|
- on sc.NAME = scc.COLNAME and scc.TABLE_TYPE = 'TABLE' and
|
|
|
- scc.SCHNAME = (select CURR_SCH
|
|
|
- from V$SESSIONS
|
|
|
- WHERE CURR_SCH = 'als'
|
|
|
- LIMIT 1) and
|
|
|
- scc.TVNAME = so.NAME
|
|
|
- where so.TYPE$ = 'SCHOBJ'
|
|
|
- and so.SUBTYPE$ = 'UTAB'
|
|
|
- and so.PID = -1
|
|
|
- and so.SCHID =
|
|
|
- (select ID
|
|
|
- from SYS.SYSOBJECTS
|
|
|
- where TYPE$ = 'SCH'
|
|
|
- and NAME = (select CURR_SCH
|
|
|
- from V$SESSIONS
|
|
|
- WHERE CURR_SCH = 'als'
|
|
|
- LIMIT 1))
|
|
|
- and so.NAME = #{tableName}
|
|
|
- order by sc.COLID
|
|
|
+ select lower(temp.column_name) as column_name,
|
|
|
+ (case when (temp.nullable = 'N' and temp.constraint_type != 'P') then '1' else null end) as is_required,
|
|
|
+ (case when temp.constraint_type = 'P' then '1' else '0' end) as is_pk,
|
|
|
+ temp.column_id as sort,
|
|
|
+ temp.comments as column_comment,
|
|
|
+ (case when temp.constraint_type = 'P' then '1' else '0' end) as is_increment,
|
|
|
+ lower(temp.data_type) as column_type
|
|
|
+ from (
|
|
|
+ select col.column_id, col.column_name,col.nullable, col.data_type, colc.comments, uc.constraint_type
|
|
|
+ , row_number() over (partition by col.column_name order by uc.constraint_type desc) as row_flg
|
|
|
+ from user_tab_columns col
|
|
|
+ left join user_col_comments colc on colc.table_name = col.table_name and colc.column_name = col.column_name
|
|
|
+ left join user_cons_columns ucc on ucc.table_name = col.table_name and ucc.column_name = col.column_name
|
|
|
+ left join user_constraints uc on uc.constraint_name = ucc.constraint_name
|
|
|
+ where col.table_name = upper(#{tableName})
|
|
|
+ ) temp
|
|
|
+ WHERE temp.row_flg = 1
|
|
|
+ ORDER BY temp.column_id
|
|
|
</if>
|
|
|
|
|
|
</select>
|