开发者

Oracle - Source does not have runnable target

开发者 https://www.devze.com 2023-04-03 18:48 出处:网络
I am completely new to Oracle. I am trying to create a package but it throws me an error: Source does not have a runnable target.

I am completely new to Oracle.

I am trying to create a package but it throws me an error: Source does not have a runnable target.

What i want to do is create a package and define some stored procs in the package body.

This is how my package definition looks like:

CREATE O开发者_运维技巧R REPLACE 
PACKAGE PAY_ZONE_PKG AS
  TYPE CURSOR_TYPE IS REF CURSOR;

  PROCEDURE spGetZones(Zones_Cursor OUT CURSOR_TYPE);

END PAY_ZONE_PKG;

This is how my package body looks like:

create or replace
PACKAGE BODY PAY_ZONE_PKG IS

PROCEDURE spGetZones(Zones_Cursor OUT CURSOR_TYPE) AS
  BEGIN
    OPEN Zones_Cursor FOR
      SELECT *
      FROM ESP.PAY_ZONE
      ORDER BY NAME ASC;
  EXCEPTION
     WHEN NO_DATA_FOUND
     THEN NULL;
  END spGetZones;

END PAY_ZONE_PKG;

When i tried to create package body, it throws the error saying

cannot compile body of 'PAY_ZONE_PKG' without its specification

What am i missing here?


cannot compile body of 'PAY_ZONE_PKG' without its specification indicates that the create or replace package PAY_ZONE_PKG was either unsucessful, or that the package specification was deleted after it was tried to compile the body.

So, the problem is not with the body, but with the specification.


I'm not able to reproduce that.

The code:

CREATE OR REPLACE 
PACKAGE PAY_ZONE_PKG AS
  TYPE CURSOR_TYPE IS REF CURSOR;

  PROCEDURE spGetZones(Zones_Cursor OUT CURSOR_TYPE);

END PAY_ZONE_PKG;

compiles.

And also the body is created successfully.

Have you tried to create them independently. First spec, and after, body.

0

精彩评论

暂无评论...
验证码 换一张
取 消