Cursors problem

Cursors problem

Post by sudhee » Fri, 28 Mar 2003 15:24:57



Hey to every body,

 I am getting error while writing the cursors. What error
i am facing means. i am using "order by" in my query. Its
not accepting. It showing error. Below iam giving my
cursor coding . please help me.

create procedure access_list1
as
begin
declare access cursor
for (select p.productname,p.productid  from tblproducts as
p join tblcategories as c on c.catid=p.catid   where
c.categoryname in('Accessories')GROUP BY
p.productname,p.productid order by p.productname)
for read only





open access


  begin



end

close access
deallocate access

return

end

 
 
 

Cursors problem

Post by Baiju K » Fri, 28 Mar 2003 15:48:58


remove the brackets it may work

create procedure access_list1
as
begin
declare access cursor
for
select p.productname,p.productid
from tblproducts as p join tblcategories as c on c.catid=p.catid
where c.categoryname in('Accessories')
GROUP BY p.productname,p.productid
order by p.productname

for read only





open access


  begin



end

close access
deallocate access

return

end


> Hey to every body,

>  I am getting error while writing the cursors. What error
> i am facing means. i am using "order by" in my query. Its
> not accepting. It showing error. Below iam giving my
> cursor coding . please help me.

> create procedure access_list1
> as
> begin
> declare access cursor
> for (select p.productname,p.productid  from tblproducts as
> p join tblcategories as c on c.catid=p.catid   where
> c.categoryname in('Accessories')GROUP BY
> p.productname,p.productid order by p.productname)
> for read only
> declare










> open access


>   begin
>   set



> end

> close access
> deallocate access

> return

> end


 
 
 

Cursors problem

Post by David Porta » Fri, 28 Mar 2003 17:13:04


Don't use a cursor.

This type of thing is really a job for the client application but see here
for an example of an alternative SQL method of concatenating strings:

http://groups.google.com/groups?selm=OFeCGsU8CHA.2412%40TK2MSFTNGP10....

Or post some DDL and sample data and someone here may be able to help you
write the query.

--
David Portas
------------
Please reply only to the newsgroup
--

> Hey to every body,

>  I am getting error while writing the cursors. What error
> i am facing means. i am using "order by" in my query. Its
> not accepting. It showing error. Below iam giving my
> cursor coding . please help me.

> create procedure access_list1
> as
> begin
> declare access cursor
> for (select p.productname,p.productid  from tblproducts as
> p join tblcategories as c on c.catid=p.catid   where
> c.categoryname in('Accessories')GROUP BY
> p.productname,p.productid order by p.productname)
> for read only
> declare










> open access


>   begin
>   set



> end

> close access
> deallocate access

> return

> end

 
 
 

Cursors problem

Post by SriSam » Fri, 28 Mar 2003 22:15:12


Can you specify what error you are getting?
--
HTH,
SriSamp
Please reply to the whole group only!


> Hey to every body,

>  I am getting error while writing the cursors. What error
> i am facing means. i am using "order by" in my query. Its
> not accepting. It showing error. Below iam giving my
> cursor coding . please help me.

> create procedure access_list1
> as
> begin
> declare access cursor
> for (select p.productname,p.productid  from tblproducts as
> p join tblcategories as c on c.catid=p.catid   where
> c.categoryname in('Accessories')GROUP BY
> p.productname,p.productid order by p.productname)
> for read only
> declare










> open access


>   begin
>   set



> end

> close access
> deallocate access

> return

> end

 
 
 

1. forms 5 - cursor problem (Not PL/SQL cursor)

Is there a way of changing the standard cursor in forms 5. Our database uses
forms 5 and our users are having difficulty seeing the cursor when tabbing
through fields in the forms. On some fields we have CENTERED the text
aligment so the cursor is in the middle of the field, but this is not
desriable on all fields

any ideas would be grateful;

martin hopkins

2. Severe errors appearing then disappearing!

3. Updateable cursor problem

4. TopLink expertise needed !!!

5. SQL Newbie updating with Cursors problem

6. Finding records that are NOT

7. SQL Cursor problem

8. PDX50 - automatic numbering

9. Crazy Cursor Problem - results not returned

10. stored proc cursor problem.

11. Cursor Problem in stored procedure

12. CURSOR PROBLEM , Database timeout, Multiple Users