0
SQL> select * from id_proof(source_table);

PANNO                ADHARNO              COLLEGEID
-------------------- -------------------- --------------------
BMBDD7715A           80DJ21761128         09751A123
PJ3AB1234B           567817231111         09751217
QDXAZ1723B           1127525423           111777A123
ZPBJT15623           27524397111          234725484

Above one is my source table and I want to below output.

Target
------
80DJ21761128
567817231111
1127525423
27524397111
09751217
234725484

Note-:First four row values are from adharno column and last two row values are from collegeid(Numeric only).

1
  • Is it on purpose to select '80DJ21761128' which contains non-digits ('D' and 'J')? Commented Oct 8, 2016 at 22:43

1 Answer 1

3

You could do something like

select adharno as target
  from id_proof(source_table)
union all
select collegeid
  from id_proof(source_table)
 where regexp_like( collegeid, '^[[:digit:]]*$' )
2
  • Thanks Justin. I don't what is wrong in above query may be instr. below query is working fine for me "select adharno target from id_proof union all select collegeid from id_proof where regexp_like( collegeid, '^[[:digit:]]*$')" Commented Oct 8, 2016 at 23:39
  • @GyanendraKumar . . . Either Justin intended > 0 or regexp_like(). Either way, the intention clearly works, so you can accept this answer. Commented Oct 9, 2016 at 0:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.