CREATE OR REPLACE VIEW RV_IMPFORMAT_ROW_VIEW
AS 
SELECT 	f.AD_IMPFORMAT_ID AS AD_IMPFORMAT_ID, 
	f.AD_CLIENT_ID AS AD_CLIENT_ID, 
	f.AD_ORG_ID AS AD_ORG_ID, 
	f.ISACTIVE AS ISACTIVE, 
	f.CREATED AS CREATED, 
	f.CREATEDBY AS CREATEDBY, 
	f.UPDATED AS UPDATED, 
	f.UPDATEDBY AS UPDATEDBY, 
	f.NAME as IMPFORMATNAME, 
	f.DESCRIPTION AS DESCRIPTION, 
	(select t.TABLENAME from AD_TABLE t WHERE t.AD_TABLE_ID=f.AD_TABLE_ID) AS TABLENAME, 
	f.FORMATTYPE AS FORMATTYPE,
    i.SEQNO AS SEQNO, 
    i.NAME as ROWNAME, 
	(select c.COLUMNNAME from AD_COLUMN c WHERE c.AD_COLUMN_ID=i.AD_COLUMN_ID) AS COLUMNNAME, 
	i.STARTNO AS STARTNO, 
	i.ENDNO AS ENDNO, 
	i.DATATYPE AS DATATYPE, 
	i.DATAFORMAT AS DATAFORMAT, 
	i.DECIMALPOINT AS DECIMALPOINT, 
	i.DIVIDEBY100 AS DIVIDEBY100, 
	i.CONSTANTVALUE AS CONSTANTVALUE, 
	i.CALLOUT AS CALLOUT, 
	i.SCRIPT AS SCRIPT
FROM AD_IMPFORMAT f
	INNER JOIN AD_IMPFORMAT_ROW i ON (f.AD_IMPFORMAT_ID = i.AD_IMPFORMAT_ID)
/
