Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to search for a new line character in sql

user8731258Nov 11 2009 — edited Nov 17 2009
hi..i am using oracle 10g.
basically i am looking for usage of columns.I want to see which all columns are used in
joins.
this is the quey i have written.
but
if there a new line between WHERE ,AND those scenarios are ignored.how to take care of these new line characters?


SELECT DISTINCT s.TYPE, s.NAME, s.owner, table_name, column_name --,line,text
FROM all_source s, cols c, all_dependencies d
WHERE s.NAME = d.NAME
AND d.referenced_name = c.table_name
AND c.table_name = 'WSF_EDUCATION_ORGUNIT'
AND column_name ='ORGUNIT_TYPECODE_OID'
AND d.TYPE = s.TYPE
AND d.TYPE <> 'PACKAGE'
AND d.owner = s.owner ---FOR OVERLOADED OBJECTS
AND ( (UPPER (text) LIKE
'%' || 'AND' || '%' || column_name || ' ' || '=%'
)
OR (UPPER (text) LIKE
'%' || 'AND' || '%=' || ' ' || '%' || column_name
|| '%'
)
)
UNION ---if there is where
SELECT DISTINCT s.TYPE, s.NAME, s.owner, table_name,
column_name ----,line,text
FROM all_source s, cols c, all_dependencies d
WHERE s.NAME = d.NAME
AND d.referenced_name = c.table_name
AND c.table_name = 'WSF_EDUCATION_ORGUNIT'
AND column_name ='ORGUNIT_TYPECODE_OID'
AND d.TYPE = s.TYPE
AND d.TYPE <> 'PACKAGE'
AND d.owner = s.owner ---FOR OVERLOADED OBJECTS
AND ( (UPPER (text) LIKE
'%' || 'WHERE' || '%' || column_name || ' ' || '=%'
)
OR (UPPER (text) LIKE
'%' || 'WHERE' || '%=' || ' ' || '%' || column_name
|| '%'
)
)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 15 2009
Added on Nov 11 2009
13 comments
9,843 views