当前位置: 代码迷 >> Oracle开发 >> 写了个存储过程 出有关问题了 求高手看下
  详细解决方案

写了个存储过程 出有关问题了 求高手看下

热度:23   发布时间:2016-04-24 07:35:35.0
写了个存储过程 出问题了 求高手看下
Select * From jobs;

CREATE OR REPLACE Procedure conn_pro
(v_Id In Varchar2,v_title In Varchar2)
As
Declare
Type r_type Is Record(
  v_myId jobs.job_id%Type,
  v_title jobs.job_title%Type
);

v_r1 r_type;
Cursor mycursor Is Select job_id,job_title From jobs;
Begin
  Open mycursor;
  Loop When mycursor%Found
  Fetch mycursor Into v_r1;
  dbms_output.put_line(v_r1.myId,v_r1.title);
  Close mycursor;
  End Loop;
End;

报错说

Compilation errors for PROCEDURE HR.CONN_PRO

Error: PLS-00103: 出现符号 "("在需要下列之一时:
  := . ) , @ % default
  character
  符号 ":=" 被替换为 "(" 后继续。
Line: 2
Text: (v_Id In Varchar2,v_title In Varchar2)

Error: PLS-00103: 出现符号 "("在需要下列之一时:
  := . ) , @ % default
  character
  符号 ":=" 被替换为 "(" 后继续。
Line: 2
Text: (v_Id In Varchar2,v_title In Varchar2)

Error: PLS-00103: 出现符号 "DECLARE"在需要下列之一时:
  begin function package
  pragma procedure subtype type use <an identifier>
  <a double-quoted delimited-identifier> form current cursor
  external language
  符号 "begin" 被替换为 "DECLARE" 后继续。
Line: 4
Text: Declare

Error: PLS-00103: 出现符号 "end-of-file"在需要下列之一时:
  begin case declare
  end exception 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
Line: 17
Text: End;

------解决方案--------------------
SQL code
CREATE OR REPLACE Procedure conn_pro(v_Id In Varchar2, v_title In Varchar2) As  Type r_type Is Record(    v_myId  jobs.job_id%Type,    v_title jobs.job_title%Type);  v_r1 r_type;  Cursor mycursor Is    Select job_id, job_title From jobs;Begin  Open mycursor;  Loop    exit when mycursor%notFound;    Fetch mycursor      Into v_r1;    dbms_output.put_line(v_r1.v_myId || v_r1.v_title);  End Loop;  Close mycursor;End;
------解决方案--------------------
探讨
SQL code

CREATE OR REPLACE Procedure conn_pro(v_Id In Varchar2, v_title In Varchar2) As

Type r_type Is Record(
v_myId jobs.job_id%Type,
v_title jobs.job_title%Type);

v_r1 r_typ……

------解决方案--------------------
探讨
SQL code


CREATE OR REPLACE Procedure conn_pro(v_Id In Varchar2, v_title In Varchar2) As

Type r_type Is Record(
v_myId jobs.job_id%Type,
v_title jobs.job_title%Type);

v_r1 r_t……
  相关解决方案