ошибка declare cursor

_test_
Дата: 20.11.2009 08:48:09
Ребят, подскажите, что не так???

------------------------------------------------------------------------------------------
create or replace procedure CHECK_NEW_ORDERS(order_id in integer) is
declare
cursor c1 is select * from reservations_orders where reservations_orders.id_orders=order_id;
cursor c2 is select * from guest_rooms g, hotels h where g.id_of_hotel=h.id_of_hotel;
begin

end CHECK_NEW_ORDERS;

------------------------------------------------------------------------------------------

Ошибка:

------------------------------------------------------------------------------------------
Ошибки компиляции PROCEDURE ADMIN4.CHECK_NEW_ORDERS

Ошибка: PLS-00103: Encountered the symbol "DECLARE" when expecting one of the following:

begin function package pragma procedure subtype type use
<an identifier> <a double-quoted delimited-identifier> form
current cursor external language
The symbol "begin" was substituted for "DECLARE" to continue.
Строка: 2
Текст: declare

Ошибка: PLS-00103: Encountered the symbol "END" when expecting one of the following:

begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe
Строка: 7
Текст: end CHECK_NEW_ORDERS;

------------------------------------------------------------------------------------------

Перенес объявление в блок бегин-энд:

------------------------------------------------------------------------------------------
create or replace procedure CHECK_NEW_ORDERS(order_id in integer) is

begin
declare
cursor c1 is select * from reservations_orders where reservations_orders.id_orders=order_id;
cursor c2 is select * from guest_rooms g, hotels h where g.id_of_hotel=h.id_of_hotel;
end CHECK_NEW_ORDERS;

------------------------------------------------------------------------------------------
, а ошибка:
------------------------------------------------------------------------------------------
Ошибка: PLS-00103: Encountered the symbol "END" when expecting one of the following:

begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe
Строка: 7
Текст: end CHECK_NEW_ORDERS;

-----------------------------------------------------------------------------------------
остается. Да и вообще переносить помоему нельзя, попробывал перенести после попытки перевода первой ошибки. Скажите почему при компиляции даже пустой процедуры возникает эта ошибка, да и вообще - где объявить курсоры??

Всем большое спасибо.
Elic
Дата: 20.11.2009 09:16:13
-2-
Дата: 20.11.2009 09:18:49
_test_,

пробывал
По вашему запросу найдено 189 тем.
Популярное словечко в теме про оракл.
Сравнил с MSSQL - 430! При соотновшении постов оракл=695142 и мсскул=793161, на платформе микрософта в два раза чаще чего-то пробывают.
-2-
Дата: 20.11.2009 09:19:50
-2-,

"соотновшении" - сам такой!
_test_
Дата: 20.11.2009 09:36:29
Если вопрос напрягает можно не отвечать. В гугл я лазил!

Мне статья не дала полного ответа. Ребят, кому не сложно. помогите. Спасибо.
Elic
Дата: 20.11.2009 09:38:58
_test_
В гугл я лазил!
А тебя не туда послали, а в доку. Про элементарщину почитать.
-2-
Дата: 20.11.2009 09:49:00
_test_,

Читать-то умеешь?:
Тест твоей ошибки
Encountered the symbol "DECLARE" when expecting one of the following:

begin function package pragma procedure subtype type use
<an identifier> <a double-quoted delimited-identifier> form
current cursor external language

Oracle Doc
The declarative part contains local declarations, which are placed between the keywords IS and BEGIN. The keyword DECLARE is not used. The executable part contains statements, which are placed between the keywords BEGIN and EXCEPTION (or END). One or more RETURN statements must appear in the executable part of a function. The exception-handling part contains exception handlers, which are placed between the keywords EXCEPTION and END.
Если проблемы
_test_
Дата: 20.11.2009 10:21:16
тем не менее ошибка Encountered the symbol "END" when expecting one of the following... осталась :(
_test_
Дата: 20.11.2009 10:27:19
Спасибо всем, разобрался:

create or replace procedure CHECK_NEW_ORDERS(order_id in integer) is

cursor c1 is select * from reservations_orders r, guest_rooms g, hotels h;

begin

open c1;
commit;
close c1;
/* where
r.id_orders=order_id and
g.id_of_hotel=h.id_of_hotel and
r.resident_count=g.resident_count and
r.room_count=g.rooms_count and
r.guest_room_type=g.room_type and
r.country=h.country and
r.hotel_class=h.hotel_class;*/


end CHECK_NEW_ORDERS;
tru55
Дата: 20.11.2009 10:29:54
1. DECLARE выкинул?
2. между BEGIN и END должно быть хоть что-то. Если хочешь скомпилировать пустую процедуру, вставляй пустой оператор
BEGIN
   null;
END;