• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 266
  • Last Modified:

programming in plsql


each value of 1 is representing an error that is now I have 3 errors and error number would be the position of the 1 in the binary number


how to write a procedure that checks each position (1-31 since they have 31 errors) and if it’s a 1 in the position, then that’s the error.

so I should get result as
error number 1
error number 2  
error number 22

thanks very much in advance.


  • 3
  • 2
1 Solution
slightwv (䄆 Netminder) Commented:
Try this:

create or replace procedure myproc(inStr in varchar2)

	for i in 1..length(inStr) loop
		if substr(inStr,-i,1) = '1' then
			dbms_output.put_line('error number ' || i);
		end if;
	end loop;

show errors

exec myproc('1000000000000000000011');

Open in new window

vsarma50Author Commented:
great thanks very much
vsarma50Author Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for vsarma50's comment http:/Q_27346372.html#36718920

for the following reason:

i appreciated in my response comment
slightwv (䄆 Netminder) Commented:
Did you mean to accept your own post as the answer?
slightwv (䄆 Netminder) Commented:
You never responded to my question so I'll have to Object and involve a Moderator.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now