PLS-00201 error from PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • harvey1
    New Member
    • Apr 2008
    • 3

    PLS-00201 error from PHP

    I'm having problems running an Oracle stored procedure
    that returns a cursor to from a web front end. The problem
    occurs both with PHP and ASP.NET.

    The error is the familiar
    "PLS-00201:identifie r' <User>.<Procedu re Name> ' must be declared"

    Note: the procedure runs fine from sql*plus, so I know the spec
    and body are ok.

    The package spec and body are as follows:
    Code:
    CREATE OR REPLACE PACKAGE tag_data 
    AS
        PROCEDURE tag_GetAll(rst OUT SYS_REFCURSOR);
    END tag_data;
    
    CREATE OR REPLACE PACKAGE BODY tag_data 
    AS
       PROCEDURE tag_GetAll(rst OUT SYS_REFCURSOR)
       AS
       BEGIN
        OPEN rst FOR SELECT * FROM Tag;
       END;
     END tag_data;
    As I noted, The procedure runs fine from sql*plus.
    For instance, via this sequence of commands:
    Code:
       var rst refcursor;
       exec tag_data.tag_getall(:rst);
       print rst;

    Following is a portion of the PHP I've used. (I can provide the ASP also.)
    [PHP] $con = oci_connect(<lo gin>, <pwd>, <service name>);
    $s = oci_parse($con, 'BEGIN tag_data.tag_ge tall(:rst); END;');
    $rst = oci_new_cursor( $con);
    oci_bind_by_nam e($s, ":rst", $rst, -1, OCI_B_CURSOR);
    oci_execute($s) ;[/PHP]

    The last step results in the PLS-00201 error on tag_data.tag_ge tall

    Googling around suggests this is a permissions problem.
    I have granted EXECUTE permission to the package to PUBLIC and ANONYMOUS, with no change.
    Also: the login I'm using is the same that I use from sql*plus so presumably
    the same permissions should apply, no?

    Thanks
  • harvey1
    New Member
    • Apr 2008
    • 3

    #2
    A slight correction to my initial post:
    I should have said: "PLS-00201:identifie r' <Package Name>.<Procedur e Name>,
    rather than: "PLS-00201:identifie r' <User>.<Procedu re Name>

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      grant the permission to the procedure also

      grant to packagename.pro cedure name

      again call from your frontend.

      Comment

      • harvey1
        New Member
        • Apr 2008
        • 3

        #4
        Hmm. After some research, it appears that:

        1) Granting privileges to the package automatically grants the same privileges to procedures within the package.

        2) It is not clear that it is even possible, without some workaround, to grant privileges to specific procedures in a package. For instance:
        Code:
        GRANT EXECUTE on tag_data to public;
        works fine, butGRANT EXEC
        [HTML]GRANT EXECUTE on tag_data.tag_ge tall to public;[/HTML]
        coughs up an error.

        In fact, I'm not yet convinced this is a permissions problem. (It is annoying that Oracle doesn't give a more informative error message.) For, as I mentioned, I can successfully call the procedure from sql*plus, using the same login.


        Originally posted by debasisdas
        grant the permission to the procedure also

        grant to packagename.pro cedure name

        again call from your frontend.

        Comment

        Working...