Home » SQL & PL/SQL » SQL & PL/SQL » How to take control from exception section to the body...
How to take control from exception section to the body... [message #275307] Fri, 19 October 2007 06:50 Go to next message
vishalvinayak
Messages: 1
Registered: October 2007
Junior Member
My problem is:

Suppose a table has a column name 'code' with values

code
-------
113
1124
543
6546
786
333
6646
553

Now suppose i've to pass a 10 digit number to a function
whose initial 3 or 4 (or may be 5) digits are similar to one of the rows of the column...........

eg:

a given number is 11345646
i'll first search it in the table---not found???
i'll trim the last digit and find again...not found??
repeat until found......

the number found in the end needs to be returned..

now the problem is if i use sql%notfound in a loop the control jumps to the exception section.......

SO ANYONE HAS ANY SOLUTION??????
Re: How to take control from exception section to the body... [message #275310 is a reply to message #275307] Fri, 19 October 2007 07:01 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please read and follow OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format. Use the "Preview Message" button.
Please always post your Oracle version (4 decimals).

Post your current function as well as the test you made (copy and paste your screen).

Regards
Michel

[Updated on: Fri, 19 October 2007 07:02]

Report message to a moderator

Re: How to take control from exception section to the body... [message #275311 is a reply to message #275307] Fri, 19 October 2007 07:22 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
You can do it using SQL in a single statement.
Do it using where instr(????,????) = 1
Then select the max of the found values.
I leave it to you to finish this.
Previous Topic: plsql
Next Topic: How to do bulk Data Extraction in single time
Goto Forum:
  


Current Time: Sat Dec 03 17:54:41 CST 2016

Total time taken to generate the page: 0.12294 seconds