Need help running a function in a package

Hi,
I am trying to execute a function called "IsGuest" which is stored in a package called "PK_USER_ROLE". This procedure returns a boolean as a result. Here is the PHP code in the web page I am using:
     echo "<br/>Test to execute a stored procedure";
     $s = oci_parse($conn, "begin :ret := PK_USER_ROLE.IsGuest(:userid); end;") or die ('Can not parse query');
     $myid = "huppe";
     oci_bind_by_name($s, ':ret', $r, 40);
     oci_bind_by_name($s, ':userid', $myid);
     oci_execute($s);
     echo "<br/>result=".$r;
     echo "<br/>Completed<br/><br/>";
     oci_free_statement($s);
     oci_close($conn);
In Oracle, here is the package definition:
create or replace
PACKAGE PK_USER_ROLE IS
function IsGuest (i_unique_id in varchar2) return boolean;
END;
All I get back when I view the PHP file in the browser is:
Test to execute a stored procedure
result=
Completed
PHP 5.3.8
Oracle 11g
OCI8 extension
Any help would be appreciated

I find it helpful to turn on errors and warnings in php.ini during
development.
    display_errors  = On
    error_reporting = E_ALL | E_STRICTor use the ini_set() equivalents in your script. For production,
make sure errors are logged but not displayed to users.
Your script then gives:
    $ php54 t.php
    Test to execute a stored procedurePHP Warning:  oci_execute(): ORA-06550: line 1, column 15:
    PLS-00382: expression is of wrong type
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored in /tmp/t.php on line 10
    Warning: oci_execute(): ORA-06550: line 1, column 15:
    PLS-00382: expression is of wrong type
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored in /tmp/t.php on line 10See the comment below the table in
http://docs.oracle.com/cd/E11882_01/appdev.112/e10646/oci03typ.htm#CEGIEEJI
+"The following two types are internal to PL/SQL and cannot be returned as values by OCI:+
+Boolean, SQLT_BOL+
+Record, SQLT_REC"+
Since PHP OCI8 is written in OCI, this limitation is inherited.
Try something like:
  $s = oci_parse($conn, "begin if (IsGuest(:userid) = true) then :ret := 1; else :ret := 0; end if; end;") or die ('Can not parse query');

Similar Messages

  • I need help with Analytic Function

    Hi,
    I have this little problem that I need help with.
    My datafile has thousands of records that look like...
    Client_Id Region Countries
    [1] [1] [USA, Canada]
    [1] [2] [Australia, France, Germany]
    [1] [3] [China, India, Korea]
    [1] [4] [Brazil, Mexico]
    [8] [1] [USA, Canada]
    [9] [1] [USA, Canada]
    [9] [4] [Argentina, Brazil]
    [13] [1] [USA, Canada]
    [15] [1] [USA]
    [15] [4] [Argentina, Brazil]
    etc
    My task is is to create a report with 2 columns - Client_Id and Countries, to look something like...
    Client_Id Countries
    [1] [USA, Canada, Australia, France, Germany, China, India, Korea, Brazil, Mexico]
    [8] [USA, Canada]
    [9] [USA, Canada, Argentina, Brazil]
    [13] [USA, Canada]
    [15] [USA, Argentina, Brazil]
    etc.
    How can I achieve this using Analytic Function(s)?
    Thanks.
    BDF

    Hi,
    That's called String Aggregation , and the following site shows many ways to do it:
    http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
    Which one should you use? That depends on which version of Oracle you're using, and your exact requirements.
    For example, is order importatn? You said the results shoudl include:
    CLIENT_ID  COUNTRIES
    1        USA, Canada, Australia, France, Germany, China, India, Korea, Brazil, Mexicobut would you be equally happy with
    CLIENT_ID  COUNTRIES
    1        Australia, France, Germany, China, India, Korea, Brazil, Mexico, USA, Canadaor
    CLIENT_ID  COUNTRIES
    1        Australia, France, Germany, USA, Canada, Brazil, Mexico, China, India, Korea?
    Mwalimu wrote:
    ... How can I achieve this using Analytic Function(s)?The best solution may not involve analytic functions at all. Is that okay?
    If you'd like help, post your best attempt, a little sample data (CREATE TABLE and INSERT statements), the results you want from that data, and an explanation of how you get those results from that data.
    Always say which version of Oracle you're using.
    Edited by: Frank Kulash on Aug 29, 2011 3:05 PM

  • Running a function inside a package

    This is kind of a noob question: I have a function. I want to use this function inside a package. The function is not created inside the package.

    Here is an example;
      1  create or replace function test_func(v_one number, v_two number)
      2  return number
      3  as
      4  begin
      5  return v_one + v_two;
      6* end;
    SQL> /
    Function created.
    SQL> select test_funct(10,20) from dual
      2  /
    select test_funct(10,20) from dual
    ERROR at line 1:
    ORA-00904: "TEST_FUNCT": invalid identifier
    SQL> select test_func(10,20) from dual
      2  /
    TEST_FUNC(10,20)
                  30
    SQL> create or replace package test_pkg as
      2  procedure test_proc(v_name varchar2, v_one number, v_two number);
      3  end test_pkg;
      4  /
    Package created.
    SQL>
      1  create or replace package body test_pkg as
      2  procedure test_proc(v_name varchar2, v_one number, v_two number) is
      3  begin
      4     dbms_output.put_line(v_name || ' ' || test_func(v_one, v_two));
      5  end;
      6* end test_pkg;
    SQL> /
    Package body created.
    SQL> set serveroutput on
    SQL> exec test_pkg.test_proc('Krystian',10,20)
    Krystian 30
    PL/SQL procedure successfully completed.With kind regards
    Krystian Zieja

  • Need help pl/sql function body returning SQL query - Reports

    I need help with Grouping by on a report that I developed in my application.
    I have posted my Code in
    Apex.oracle.com
    workspace : c a s e _ m a n a g e m e n t
    User Id : public
    Password : public
    I need help on Page 38 Reports.
    I get blank lines when I do break by first , second and third columns on the reports attribute.
    So I think I have to write "group by " or Distinct in side the SQL query. But not sure how to do it there.
    Thank you

    Is this an APEX question, then try here:
    Oracle Application Express (APEX)
    Is this an Oracle Reports question, then try here:
    Reports
    Is this an SQL question:
    Please provide sample data and expected output. Also please show what you have tried already.

  • Compatability Issue: Need Help Disabling Additional Functions - URGENT!

    I am experiencing a problem with running Pro Tools 8.0.4 LE on my HP Pavilion dv7, which is encountered as a DAE error -6006 when loading Pro Tools. Research indicates that this error relates somehow to the firewire connection, and I am able to use Pro Tools on this system with a different interface (one that only has two microphone inputs) that allows me to connect via USB.
    Also, when I do run Pro Tools via USB it seems that I can't use the Quick Punch feature without a minimum 10 second (usually a lot longer) delayed response after pressing the playback or record button!
    I have been emailing Pro Tools support back and forth daily for 10 days now, and in the most recent email, they have said:
    "This might be an incompatibility issue. HP Pavilion dv7 laptop is not tested by our US headquarter testing team 
    and not officially supported.
    As you have found by yourself, each PC manufacture pre- installs their own features (as TV tuner) and the program into 
    Windows OS , the motherboard and BIOS. They work differently to Pro Tools and sometimes conflict. That is why we cannot support those PCs we have not tested.
    Please turn off all the additional function by HP from BIOS. Please ask HP support how to do."
    Therefore, I am requesting assistance with disabling all unnecessary services and processes on my HP laptop. I am assuming that the TV tuner is not a necessary service, but I have no idea about most of the others, and obviously I don't want to disable something that is necessary.
    If you could help me ASAP I would really appreciate it, as I need to get on with recording urgently! Thank you.
    This question was solved.
    View Solution.

    UPDATE:
    I have also been advised by Pro Tools support that if I add a supported FireWire card with Texas Instrument FireWire chip onto my computer, it may solve the problem. When I asked them how to go about doing this, they responded:
    "If your PC has Express Card slot, 
    http://avid.custkb.com/avid/app/selfservice/search.jsp?DocId=352647
    SIIG FireWire 2-Port ExpressCard
    is tested and supported FireWire card.
    Please ask HP about the spec of your computer."

  • What are the files we need to run for to use dbms_java package..

    Hi,
    I want to call java class files in PL/SQL code. I have created the .class file while loading into oracle, showing an error saying that DBMS_JAVA.SHORT_NAME must be declared and some errors like java/io/lang,, Please tell me the necessary packages to run in the database..?
    Regards,
    G. Rajakumar.

    Hi,
    I want to call java class files in PL/SQL code. I have created the .class file while loading into oracle, showing an error saying that DBMS_JAVA.SHORT_NAME must be declared and some errors like java/io/lang,, Please tell me the necessary packages to run in the database..?
    Regards,
    G. Rajakumar. Raja,
    I believe the top-level script our DBAs run is initjvm.sql. It's usually in <oracle home>\javavm\install. You might want to double-check to make sure this is the only thing you'll need.
    Hope this helps,
    -Dan
    http://www.compuware.com/products/numega/dbpartner/dbpordebug.htm
    Debug Java in the Oracle Database

  • Need help in simple function

    Hi,
    i am using sql developer to write a simple function .which need to get job details by using employ number
    ..below is the function
    CREATE OR REPLACE
    FUNCTION Q_JOB(empno1 in emp.empno%type) RETURN VARCHAR2 AS
    job1 varchar2(100);
    BEGIN
    select job into job1 from
    emp where empno=empno1;
    dbms_output.put_line('job :'||job1);
    RETURN job1;
    END Q_JOB;
    when i am trying to run this using command
    execute q_job(7369);
    i am getting folowing error..
    PL/SQL: Statement ignored
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:
    can any one tell whats exact problem is?

    You can use execute only for procedures, not functions.
    You have different possibilities:
    * If you like issuing the statement from a worksheet, use an anonymous block:
    DECLARE
      v_job  emp.job%type;
    BEGIN
      v_job = q_job(7369);
    END;
    / * Alternatively, use your function in SQL:
    SELECT q_job(7369) FROM DUAL; * For editing and testing your PL/SQL code, sqldev has very cool features: editor, compiler and debugger.
    Under the Functions node under your connection, you'll find your function: right-click and Edit it. Just above your code you have a mini-toolbar to Compile your code, Run or Debug it. A lot more on this inside the Help topics.
    Using the last 2 possibilities will provide you the returned value, so using dbms_output in your function isn't even necessary.
    Have fun,
    K.

  • Need Help Running Servlets

    I have JRun installed along with IIS 5.0 and I'm learning Servlets through the book "Java Servlets" by Karl Moss. I have written my first servlet but he doesn't do a good job telling you how to get started. I need to know how to get my server ready to run the servlets and in what format to save the servlets. I have Homesite 5 and when I create a new servlet, it wants to save the file as a .java. I need some newbie help. Thanks, Jeremy

    you should make sure of the follwoing when trying to run your servlet on the browser:
    1. make sure that your classpath set properly,
    2. make sure that the class path include the api related to servlets, such as servlet.jar, and other jar files.
    3. complie your servlet, and package it properly, so that the container can locate it.
    if you done the above, then things will work
    I really advice you to check moreservlet.com, because it contains information on how to set up the environment when using either tomcat, jrun, or iplanet
    regards

  • NEED Help Running Out Of Time+++Q:Opening a PSD file in Illustrator Question???

    Hello everyone!!! Hope everyone is staying dry and warm!!!
    I have some artwork im doing for screen printing and a friend has been sending me some artwork to work on. The problem we are having is some of the artwork will open in Illustrator or CorelX4 and stay editable but then he will send me some that when I open in Illustrator it gives me this message and then will not be editable:
                           """This document has greater than 8-bit depth it will be imported as an 8-bit flat composite""""
    Can anyone tell us why this is happening??? I have researched this with no answers so far??? He is using PSD2 and Im usin PSD4 and Illustrator4
    Please help!!!!! Running out of time for this artwork to be completed.
    Thanks
    Bobby

    Photoshop is capable of saving files that are 16 or 32 bit depth. This has to do with the amount of colors that are accessable. The message you are seeing is telling you that it will convert the file back to 8 bit color space for you. This bit depth is talking about per channel, not over all. So a cmyk file would have 8 bits for cyan, 8 for megenta, 8 for yellow and 8 for black. Having a higher amount of bits per channel, photoshop is then capable of doing things like smoother gradients, retreiving data from raw images to produce an image that shows more highlights and shadows without the clipping and so forth.
    Most basic monitors are only 8 bit, same goes for most printers. So unless you need to access the extra color depth, you should be fine in 8 bit. If you don't want to see this message, just tell your friend to send the images at 8 bit.

  • Need help for Conversion Function in Oracle

    Hi, Can Any One help me Please.
    I need a Oracle conversion script for converting from decimal to hex. and decimal to datetime.
    Thanks In Advance.

    Hi,
    for the Hex-Number-conversion see:
    [url http://psoug.org/snippet/Convert-Hex-to-Decimal-Decimal-to-Hex_78.htm] self-defined Conversion-Functions
    What number format do you have? YYYMMDD
    Or is there a Date corresponding to 1 and a number n represent the date n-1 days after day 1?
    Please describe further.
    Bye
    stratmo

  • Need help in to_char function

    Hi All,
    I'm using below sql query to get sysdate with time stamp.
    select to_char(sysdate,'YYYYMMDD HH24:MM:SS') from dual
    This gives me below result:  20130816 05:08:49
    Strangely, when I keep on running the same query, I notice after 60 seconds are complete, time stamp starts with  20130816 05:08:01 again.
    Am i missing something here..
    Thanks in advance

    Karthick_Arp wrote:
    Keep a simple thing in mind. Date stored in the DB does not have any format. Format need to be applied while you display. The default date format is specified by the NLS_DATE_FORMAT parameter. You have used TO_CHAR to display date in a specific format. But the problem is that you have converted DATE into string. So if its just for display purpose then set the NLS_DATE_FORMAT, do not use TO_CHAR.
    With respect to your issue You need to represent Minute as MI. You have represented it as MM (Month) That's why you see 08 always.
    " the problem is that you have converted DATE into string"
    No, the problem was that he was explicitly using an incorrect format mask, specifying months where he should have specified minutes.
    The problem inherently cannot be the result of converting a DATE into a string.  Dates are always converted to strings for presentation, either implicitly by using the controlling setting of NLS_DATE_FORMAT (which can be set at several levels) or explicitly by using the to_char function.  Oracle will always convert.  It has to.  Internally, a date is binary gibberish.  But computer screens and printers can only show strings of characters, so the DATE will be converted to a character string, by hook or by crook.  And the method of oracle making that conversion is exactly the same.  The only thing that varies is how the user chooses to make that specification.  And "not choosing" (by not using the to_char function) is still choosing ... choosing to rely on nls_date_format.

  • Need Help Troubleshooting Copy Function

    When I try to copy a page using the flatbed scanner, the printer will scan the page and act like it's going to perform the copy.  However, after about 20 seconds, the printer spits out a blank page and on the touchscreen, it says "Printing canceled."  (I did NOT touch anything on the printer to cancel the Copy request.)  After that, the printer never recovers, i.e. it hangs on the "printing canceled" message.  I end up powering the printer off, waiting a few seconds, powering it back on, and trying to copy the page again.  Thankfully, the copy function performs as expected, no problem.
    This process occurs every time I try to copy something, and I think it's silly to believe that I need to power my printer off then turn it back on every time I want to copy something.  My settings are very simple: Make one copy, 1-to-1 sided, black ink.
    Any help in trying to figure out why my printer does this, or how to make it work properly on the first attempt, would be appreciated.

    Hello mamacgl,
    Welcome to the HP Forums.
    I see that you are having some copy issues.
    I have seen this issue in the past and I was able to get it resolved by doing one simple step.
    Please make sure that you have the printer power cable connected directly to a wall outlet and not a power bar/strip. Here is a document that uses a LaserJet printer as an example but it is meant for HP products in general. Please click on the following link that explains the Issues when Connected to an Uninterruptible Power Supply/Power Strip/Surge Protector.
    Once the printer is powered back on, use the on/off button to do a proper power cycle.  This will do a semi power reset on the printer.
    Try another copy and let me know if you still have issues or if you have any other questions, feel free to ask.
    Cheers,  
    Click the “Kudos Thumbs Up" at the bottom of this post to say “Thanks” for helping!
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    W a t e r b o y 71
    I work on behalf of HP

  • Need help with responsibility/ functions query

    hi,
    we are working in oracle applications 11i.
    I have a requirement to extract the responsibility list of functions and menus.
    I need to omit the excluded menus from each responsibility
    this what I have so far (after researching the internet):
    SELECT
    FRTL.RESPONSIBILITY_NAME,
    FFL.USER_FUNCTION_NAME, FFF.FUNCTION_NAME,ft.RESPONSIBILITY_NAME
    FROM
    FND_USER_RESP_GROUPS FURG,
    fnd_responsibility_tl ft ,
    FND_RESPONSIBILITY FR,
    FND_COMPILED_MENU_FUNCTIONS FCMF,
    FND_FORM_FUNCTIONS FFF,
    FND_RESPONSIBILITY_TL FRTL,
    FND_FORM_FUNCTIONS_TL FFL
    WHERE
    FURG.RESPONSIBILITY_ID = FR.RESPONSIBILITY_ID
    and ft.RESPONSIBILITY_ID(+)= fr.RESPONSIBILITY_ID
    AND FURG.RESPONSIBILITY_APPLICATION_ID = FR.APPLICATION_ID
    AND FR.MENU_ID = FCMF.MENU_ID
    AND FCMF.GRANT_FLAG = 'Y'
    AND FCMF.FUNCTION_ID = FFF.FUNCTION_ID
    AND SYSDATE BETWEEN FR.START_DATE AND NVL(FR.END_DATE, SYSDATE+1)
    and fr.CREATION_DATE >= to_date('01-jan-2005','dd-mon-yyyy')
    AND FURG.RESPONSIBILITY_ID = FRTL.RESPONSIBILITY_ID
    AND FR.RESPONSIBILITY_ID = FRTL.RESPONSIBILITY_ID
    AND FRTL.LANGUAGE = 'US'
    AND FFL.LANGUAGE = 'US'
    AND FFF.FUNCTION_ID = FFL.FUNCTION_ID
    AND (FURG.END_DATE > SYSDATE
    OR FURG.END_DATE IS NULL)
    AND FFF.FUNCTION_NAME NOT IN
    SELECT FF.FUNCTION_NAME
    FROM FND_RESPONSIBILITY R, FND_USER_RESP_GROUPS RG
    , FND_RESP_FUNCTIONS RF, FND_FORM_FUNCTIONS FF, FND_RESPONSIBILITY_TL FRTL
    WHERE RG.RESPONSIBILITY_ID = R.RESPONSIBILITY_ID
    AND RF.RESPONSIBILITY_ID = R.RESPONSIBILITY_ID
    AND RF.RULE_TYPE = 'F'
    AND FF.FUNCTION_ID = RF.ACTION_ID
    AND FRTL.RESPONSIBILITY_ID = R.RESPONSIBILITY_ID
    AND FRTL.RESPONSIBILITY_ID = RG.RESPONSIBILITY_ID
    AND FRTL.LANGUAGE = 'US'
    help me please to exclude the menus.

    tried it and had the following error:
    if((tbl_menu_id.FIRST is NULL) or (tbl_menu_id.FIRST 1)) then
    ERROR at line 136:
    ORA-06550: line 136, column 54:
    PLS-00103: Encountered the symbol "1" when expecting one of the following:
    *. ( ) , * @ % & | = - + < / > at in is mod not range rem =>*
    *.. <an exponent (**)> <> or != or ~= >= <= <> and or like*
    between ||
    The symbol "," was substituted for "1" to continue.
    from another perspective, from applications front end, when I press ctrl +L on any responsibility menu, I get the list of the forms names.
    which database tables can I get that from?

  • Need help with MAX function to return values

    I am trying to create a report to return slow moving inventory data. One of the requests is that it return only the latest date that an item transacted upon. One sheet will show the last receipt date for a part, another will show the last time a part was issued or shipped on a sales order.
    The hiccup is that it is returning every single last time that an item was received, and every single last issuance of the material (on the second sheet) of items on hand.
    Could someone help me to define the max value function? As listed below, and many variations, the sheet comes up with no data or corrupt dates.
    MAX(Transaction Date MAX) OVER(PARTITION BY Material Transactions.Item ORDER BY Material Transactions.Item )
    Still returns both the following when in reality I just want the one with the most recent date (April 2010).
    100034     BNDSCE-105 - QUALITY BEARINGS OR EQUIVILANT     A400M     AB01D..     $0.00     WIP component issue     11-Sep-2009     -3
    100034     BNDSCE-105 - QUALITY BEARINGS OR EQUIVILANT     A400M     AD01D..     $0.00     WIP component issue     13-Apr-2010     -16
    Thank you for your assistance.
    Becka

    Hi Becka
    It does look correct. When I look at your data I can see 2 different items:
    100034 BNDSCE-105 - QUALITY BEARINGS OR EQUIVILANT A400M AB01D.. $0.00 WIP component issue 11-Sep-2009 -3
    100034 BNDSCE-105 - QUALITY BEARINGS OR EQUIVILANT A400M AD01D.. $0.00 WIP component issue 13-Apr-2010 -16
    One is AB01D and the other being AD01D. Is this expected?
    To get the right date you might want to PARTITION BY the BNDSCE-105 which might be the Item Number?
    If you can get your calculation to return the correct date then you next need to put in a new condition where the Transaction Date = MAX Transaction Date
    One part of the function that I would question is the use of MAX in both parts like this: MAX(Transaction Date MAX). You might be better just using MAX(Transaction Date) OVER ......
    Does this help?
    Best wishes
    Michael

  • Need help with Timer function

    I am using a timer class for my application such that when i log in, i immediately call the timer.start function from the Timer.java class.
    The problem i am having, is that when this timer expires, it calls an exit function, but i want it to restart the original application. i have tried to create an instance of the old session to kill its timer and a new instance that spawns a new start page, but this doesnt work well because i have both applications running and if i close either one of them, both get killed!!
    Can anyone help me out in this regard?
    Sule.
    public void timeout()
            System.err.println ("terminating");        
            System.exit(1);
                         // instance.getContentPane().add(d2.new StartPage());                     
                         // instance.setVisible(true);
                         // previousInstance.timer.stop();
            }

    hey Uhrand.. thanks for your suggestions. I really appreciate them, however it doesnt completely solve my problem. As I stated before my Timer program runs in its own class file. so i have in one class file
    public class Timer extends thread {
    public static Application dl = new Application();
    public void timeout()
                          System.err.println ("Logging-Off");
            new Application();             
            dl.timer.stop();
            }and then i have another class file for the main program like this...
    import java.awt.*;
    import javax.swing.*;
    public class Application {
        public Application() {
            app = new JFrame("'Application' restarts every 15 seconds");
            app.add(new JLabel("Please watch the Title of this frame"));
            app.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            app.setBounds((screenSize.width-400)/2, (screenSize.height-150)/2, 400, 150);
            app.setVisible(true);
            (new Thread(new Timer(app))).start();
        public static void main(String args[]) {new Application();}
        private JFrame app;
        private JFrame app;
    }when the timer expires, i am not able to create a new Application without the old Application.
    I would appreciate it if you can respond.
    thanks
    salau

Maybe you are looking for