I used to write PL/SQL programs in oracle 9i.Since windows 7 doesnt support it, switched to oracle 10g express edition. All my SQL programs are alright. But I cant put mutiple queries on a single run though. Like insert into many rows. But PL SQL programs are going crazy. Too many errors.Please help me figure out what is wrong here. How to convert 9i programs to 10g

declare
       pi constant number(5,2):=3.14;
       radius number(5);
	   area number (14,2);
	   circumference number(14,2);
	   l_limit number(2);
	   u_limit number(3);
	   
	   
begin
       l_limit:=&l_limit;	
       u_limit:=&u_limit;
	   radius:=l_limit;
       while radius<=u_limit
	   loop
			area			:=pi*radius*radius;
			circumference	:=2*pi*radius;
			insert into area VALUES(radius,area,circumference);
			radius:=radius+1;
        end loop;
end; 	   
/

create table area(radius number(5) primary key ,area number (14,2), circumference number(14,2));

Recommended Answers

All 10 Replies

Member Avatar for hfx642

Well, for one thing...
You're trying to insert into a table that doesn't exist. Area!
Because you only create the table AFTER your insert.
Reverse this and try again.
In fact, these should be in separate scripts.

Hey , I did create the table. Just that I pasted it here at the end.That is not the problem

Member Avatar for hfx642

Hey... I'm just going by what YOU posted.
So... What IS the problem?

The problem is it says that & encountered when : or < etc was expected.I found out from the internet that in oracle 10g : is used to read user input instead of &

So , I replaced & with : . Then the pop came and asked for inputs L and H limit. But as soon as I enter ,it says ; encountered at pi CONSTANT NUMBER(5,2):=3.14; So I removed that ; , then it says ; / etc missing ! What in the world is that mate? I'm totally confused. Why is 10g radically different from 9i?

Member Avatar for hfx642

It isn't!
I'll take it to work to see if I can spot anything.
Give me a day to two, and I'll get back to you.

Member Avatar for hfx642

Wait a minute.
I don't think that lines #11 and #12 are valid.
Try giving them different names for your substitution variables.

The problem was I was using HTML DB ( now called APEX )on Oracle 10g and it does support PL SQL. The program works perfectly on SQL+ commandline. Thank you for your time

Doesn't support PL SQL I mean *

Member Avatar for hfx642

Took it to work and tried it on both a 9i and 10g DB. Worked fine.
Even lines #11 and #12. (I just learned something!! Thank-you!)
I haven't had a chance to use APEX yet.
Not really sure if I want too.
I'm a Forms and Reports kinda guy!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.