Solved

programming in plsql

Posted on 2011-09-28
6
256 Views
Last Modified: 2012-05-12
hi,

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

1000000000000000000011

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.


 

0
Comment
Question by:vsarma50
  • 3
  • 2
6 Comments
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 36718834
Try this:


create or replace procedure myproc(inStr in varchar2)
is
begin

	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;

end;
/
show errors

exec myproc('1000000000000000000011');

Open in new window

0
 

Author Comment

by:vsarma50
ID: 36718920
great thanks very much
0
 

Author Comment

by:vsarma50
ID: 36814528
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
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 36719070
Did you mean to accept your own post as the answer?
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 36814529
You never responded to my question so I'll have to Object and involve a Moderator.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now