Debugging PL/SQL Functions - Aaghh help!

Hi. this is driving me nutz.
here is my function:
CREATE OR REPLACE FUNCTION MYPROC_GETCOMPID
COMPNAME IN VARCHAR2,
SITEID IN INTEGER
RETURN NUMBER IS
RVAL INTEGER;
LOCALVAR INTEGER;
BEGIN
SELECT COMPUTERID INTO LOCALVAR
FROM DATAUPLOAD.COMPUTER_LIST WHERE
COMPUTERNAME = COMPNAME AND
SITE = SITEID;
EXCEPTION
WHEN NO_DATA_FOUND THEN
LOCALVAR := 0;
RVAL:=LOCALVAR;
RETURN RVAL;
dbms_output.put_line('Local var');
dbms_output.put_line(LOCALVAR);
END MYPROC_GETCOMPID;
It gets created fine. My question is, how the F can I create a bit pl/SQL to debug this?
I tried:
begin
declare localin integer;
localin := MYPROC_GETCOMPID('MYPC1',1);
dbms_output.put_line('LOCALINT');
dbms_output.put_line(LOCALINT);
END;
... and I tried
begin
declare localin integer;
localin = MYPROC_GETCOMPID('MYPC1',1);
dbms_output.put_line('LOCALINT');
dbms_output.put_line(LOCALINT);
END;
but boy does neither of these work.
Could someone please tell me whats going wrong??
AND can you see that exception in the function? thats there because for some reason a simple is null statement fails. any guesses as to why that is happening?
many thanks for your time
I

Hi John,
Sorry, I didn't include the error output because I thought that it would be obvious to people what was wrong with how I was attempting to call the function. I'm a bit of an oracle newbie (I'm sure thats more than obvious)
Thanks for your help on the exception. I was just looking for reassurance that I was needing to handle the error like that. The data structure means that I shouldn't get too many rows (1:1 relationship between computername and computerID, thankfully!)
Heres the responses from SQL*Plus (this is Oracle8i by the way). The responses are the same whether 'MYPC1' exists in the computer_list or not, so I am guessing that there is just something I am doing not quite right in the syntax for calling this function. (infact, see below for a hello world example that also fails).
--here we see I have set up for screen output okay:-
SQL> BEGIN
2 dbms_output.put_line('Hello World!');
3 END;
4 /
Hello World!
PL/SQL procedure successfully completed.
SQL>
-- first failure:
SQL> begin
2 declare localin integer;
3 localin = MYPROC_GETCOMPID('MYPC1',1);
4 dbms_output.put_line('localin' );
5 dbms_output.put_line(localin );
6 END;
7 /
localin = MYPROC_GETCOMPID('MYPC1',1);
ERROR at line 3:
ORA-06550: line 3, column 9:
PLS-00103: Encountered the symbol "=" when expecting one of the following:
constant exception <an identifier>
<a double-quoted delimited-identifier> table LONG_ double ref
char time timestamp interval date binary national character
nchar
--- so I figure, this is a declarative syntax issue ( = as opposed to := ), so I try the following:
SQL> begin
2 declare localin integer;
3 localin := MYPROC_GETCOMPID('MYPC1',1);
4 dbms_output.put_line('localin' );
5 dbms_output.put_line(localin );
6 END;
7 /
localin := MYPROC_GETCOMPID('MYPC1',1);
ERROR at line 3:
ORA-06550: line 3, column 9:
PLS-00103: Encountered the symbol "=" when expecting one of the following:
constant exception <an identifier>
<a double-quoted delimited-identifier> table LONG_ double ref
char time timestamp interval date binary national character
nchar
The symbol "<an identifier>" was substituted for "=" to continue.
ORA-06550: line 4, column 12:
PLS-00103: Encountered the symbol "." when expecting one of the following:
constant exception <an identifier>
<a double-quoted delimited-identifier> table LONG_ double ref
char time timestamp interval date binary national charac
ORA-06550: line 5, column 12:
PLS-00103: Encountered the symbol "." when expecting one of the following:
constant exception <an identifier>
<a double-quoted delimited-identifier> table LONG_ double ref
char time timestamp interval date binary national charac
ORA-06550: line 6, column 1:
PLS-00103: Encountered the symbol "END" when expecting one of the following:
begin function package pragma
--- finally , 'hello world' failure :
SQL> begin
2 declare localst varchar(11);
3 localst = 'hello world';
4 dbms_output.put_line('localst');
5 dbms_output.put_line(localst);
6 END;
7 /
localst = 'hello world';
ERROR at line 3:
ORA-06550: line 3, column 9:
PLS-00103: Encountered the symbol "=" when expecting one of the following:
constant exception <an identifier>
<a double-quoted delimited-identifier> table LONG_ double ref
char time timestamp interval date binary national character
nchar

Similar Messages

  • How to debug PL/SQL function in Apex

    Hi,
    I have a process in Apex that uses a PL/SQL function. When I compiled it in SQLPlus, it had no errors, yet when running it in Apex, I get an error.
    'Encountered unhandled exception in process type PLSQL' in the debug message. What's the best way to handle this? Thanks.

    Hi -
    Its hard to say without seeing the code of your process, but are you sure you are submitting any required paramaters to your process from the calling apge in Apex?
    Have you checked the Session to see what values it holds, and have you turned on Debug in Apex to see the code executing (or at least the call to your process)?
    Good luck.

  • How to debug PL/SQL functions? Passing parameter and debugger error

    Hi,
    How to debug a PL/SQL function in JDeveloper? There are two problems with it:
    1) Don't see how it's possible to pass parameters required by function call (in the dialog opening after Debug -> Debug FUNCTION_NAME)
    2) In a function returning table_name%ROWTYPE (and having a record declaration for table_name%ROWTYPE), debug gives error:
    PLS-00103: Encountered symbol "/" when expecting one of ... in line
    v_Return PL/SQL RECORD;
    Debugging procedures works as expected.
    Found a similar question without answer here:
    Debugging PL/SQL with parameters

    Check
    http://www.oracle.com/technology/obe/obe9051jdev/plsqlobe/obeplsql.htm#t2
    Frank

  • LOOP in PL/SQL Function Body Help Needed

    I have a PL/SQL function that I'm trying to run and use a LOOP but I'm having some problems. I know the loop works since it output's two commas for me, which is how many records the query used for the LOOP returns, but I can't seem to find the right syntax to reference the column.
    DECLARE
    str VARCHAR2(2000) := "";
    BEGIN
    IF :P21_GLOBAL_ID IS NOT NULL THEN
    FOR q IN (
    SELECT
    ID,
    DRAW_DATE,
    ENTERED_BY
    FROM
    SAMPLE_T
    WHERE
    ID = :P21_GLOBAL_ID
    ORDER BY
    DRAW_DATE
    LOOP
    str := str || q.ID || ',' ;
    END LOOP;
    END IF;
    RETURN STR
    END;

    I just sent you the credentials.
    Interestingly, I have this same code for the source of a textarea on the page and the source for a report. I then modified the PL/SQL code as follows:
    DECLARE
         varSelect VARCHAR2(32767) := ''; --hold query SELECT definition
         varFrom VARCHAR2(32767) := ''; --hold query FROM clause definition
         varWhere VARCHAR2(32767) := ''; --hold query WHERE clause definition
         varOrderBy VARCHAR2(32767) := ''; --hold query ORDER BY clause definition
         varQuery VARCHAR2(32767) := ''; --hold query definition
    BEGIN
         IF TRIM(LOWER(TO_NUMBER(:P21_GLOBAL_TEMPLATE_ID))) IS NOT NULL THEN
              varSelect := 'SELECT SUBJECT_ID';
              varSelect := varSelect || ', SUBJECT_ID AS PHI';
              varSelect := varSelect || ', SUBJECT_ID AS ENTER_DATA';
              varSelect := varSelect || ', SUBJECT_ID AS LOGISTICA';
    for varTempQuery IN (
    SELECT
    stc.question_name as field_name,
    sti.read_security,
    sti.write_security,
    nvl(sti.validation_type,decode(stc.validation_rules,'None','TEXT_FIELD')) as validation_type,
    sti.html_caption,
    nvl(upper(sti.html_display_type),'TEXTFIELD') as html_display_type,
    sti.html_table_row,
    sti.html_table_column
    FROM
    rix.study_subject_templates sst,
    rix.study_subject_Template_items sti,
    rix.questions stc
    WHERE
    TRIM(LOWER(TO_NUMBER(sst.ss_template_Id))) = TRIM(LOWER(TO_NUMBER(:P21_GLOBAL_TEMPLATE_ID)))
    AND TRIM(LOWER(TO_NUMBER(sst.ss_Template_id))) = TRIM(LOWER(TO_NUMBER(sti.ss_Template_id)))
    AND TRIM(LOWER(TO_NUMBER(sti.phi_qid))) = TRIM(LOWER(TO_NUMBER(stc.qid)))
    AND TRIM(LOWER(TO_CHAR(sti.template_item_Status))) <> TRIM(LOWER(TO_CHAR('RETIRED')))
    ORDER BY
    sti.html_Table_row,
    sti.html_table_column
    LOOP
    varSelect := varSelect || ', ' || varTempQuery.field_name;
    END LOOP;
              varFrom := 'FROM     RIX.SUBJECTS';
              varWhere := 'WHERE STUDY_ID = ' || TRIM(LOWER(TO_NUMBER(:P21_STUDY_ID )));
              varOrderBy := 'ORDER BY';
              varOrderBy := varOrderBy || ' subject_label ';
    varQuery := varSelect || ' ' || varFrom || ' ' || varWhere || ' ' || varOrderBy;
         ELSE
    varQuery := 'SELECT SUBJECT_ID FROM SUBJECTS WHERE study_id = :P21_STUDY_ID;';
         END IF;
    RETURN varQuery;
    END;
    When I run the page now, the textarea has the SQL statement generated from the first IF block, but the report using the statement from the ELSE block. I thought it maybe was a timing issue, but both blocks reference other fields on the page, so it doesn't seem to be a timing issue. Shouldn't be a condition issue either with the IF block as the textarea and report use the same source, but are evaluating differently.
    Very odd (to me at least).

  • PL/SQL Function Syntax help please...

    Can someone help me with the syntax here please? I am sure i am doing something wrong in my LOOP.
    create or replace FUNCTION fcn_chk_dec(p_date number)
    return NUMBER
    as
    --DECLARE
    v_date NUMBER;
    v_active NUMBER;
    v_prev NUMBER;
    v_delta NUMBER;
    v_perc_delta NUMBER:
    CURSOR c_prev_active IS
         select date,people,
    lag(people,1) over (order by date)
         from stats
    where date between to_date(p_date, 'YYYYMMDD')-2 and to_date(p_date, 'YYYYMMDD')-1
         order by date desc
    BEGIN
         OPEN c_prev;
    loop
         FETCH c_prev INTO v_date,v_active,v_prev;
         exit when c_prev%NOTFOUND;
         v_delta:=v_active-v_prev;
    v_perc_delta:=trunc((v_delta/v_active*100),2)
    end loop;
    close c_prev;
    return v_perc_delta;
    END fcn_chk_dec;

    what i am trying to do is create a funtion that will return one value for the first row that comes back.
    here is my initial query. the reason i did not go with this query is because there are too many selects and i was told that's not good and slows down the system. Plus, i need to have a function call in another program that will access this function to compare it's output to a value in a table.
    here was my initial start:
    select date,people,delta,trunc((delta/people*100),2) as perc_delta
    from (select date, people,people-prev_dly_people as delta
    from
    (select date,people,
    lag(people,1) over (order by date) as prev_dly_people
    from stats
    where date between to_char(sysdate-2,'YYYYMMDD') and to_char(sysdate-1,'YYYYMMDD')
    order by date desc))
    basically, i have a table that has a total number of people. I want to get the percentage growth and decline from the most recent date and the date before it. This will give me a day to day percentage of people population change as of the most recent date.
    I need this to be a function becaus i want to be able to pass any date i want into it and get the given delta percentage at the time for the people's population.
    hope this makes sense.

  • Probs Debugging PL/SQL proc JDev903

    Im trying to debug PL/SQL functions in JDeveloper 9.0.3.
    Issue N1. In Run PL/SQL window JDev adds schema name to my function and PL/SQL block fails to compile. Im manually deleting prefix from my function and block is compiled successfully.
    Then an error happened: PLS-00302: component 'JDEV_TMP_PROC_1' must be declared
    Please advice
    Debugger attempting to connect to database.
    Executing PL/SQL: ALTER SESSION SET PLSQL_DEBUG=TRUE
    Executing PL/SQL: DECLARE
    id VARCHAR2( 30 );
    BEGIN
    id := DBMS_DEBUG.initialize( '24.27.75.30:1036303964414', 1 );
    DBMS_DEBUG.debug_on( TRUE );
    END;
    Debugger connected to database.
    Deadlock detection is not supported by the debuggee virtual machine.
    Executing PL/SQL: BEGIN MY_SCHEMA."JDEV_TMP_PROC_1"(); END;
    ORA-06550: line 1, column 11:
    PLS-00302: component 'JDEV_TMP_PROC_1' must be declared
    ORA-06550: line 1, column 7:

    JDev can debug with Oracle 8.1.7 or later.
    Is the PL/SQL you want to debug in the same schema as you are connecting? Because you mentioned schema names, I wonder if there may be a bug with trying to debug PL/SQL in a schema other than the one you are connected to. If so, can you try creating connection as the owner of the PL/SQL and see if that works?
    Thanks!
    -- Brian (JDev Team)

  • SQL Function for calculating IP Address

    Hi Experts ,
    I have an IP Range i need to find out the First Host detail for the IP using a SQL scalar function .
    Example : 11.30.10.40
    Subnet Mask is 26
    Output required
    First host: 11.30.10.1
    am confused how i can derive the first host  values from a sql function kindly help .
    Thanks
    Priya

    DECLARE @Mask TINYINT = 26;
    DECLARE @AddressIP VARCHAR(15)= '11.30.10.40';
    DECLARE @AddressValue BIGINT = PARSENAME(@AddressIP,4)*CAST(256*256*256 AS BIGINT)+PARSENAME(@AddressIP,3)*256*256+PARSENAME(@AddressIP,2)*256+PARSENAME(@AddressIP,1);
    WITH
    n0(n) AS (SELECT 0 UNION ALL SELECT 0)
    ,n1(n) AS (SELECT 0 FROM n0 a CROSS JOIN n0)
    ,n2(n) AS (SELECT 0 FROM n1 a CROSS JOIN n1)
    ,n3(n) AS (SELECT 0 FROM n2 a UNION ALL SELECT 0 g FROM n2)
    ,t (n) AS (SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) FROM n3)
    ,bits(b,v) AS (SELECT n,POWER(CAST(2 AS BIGINT),32-n) FROM t)
    SELECT @AddressIP [Address]
    ,CAST((SUM(v) / 256 / 256 / 256) % 256 AS VARCHAR(3)) + '.' + CAST((SUM(v) / 256 / 256) % 256 AS VARCHAR(3)) + '.' + CAST((SUM(v) / 256) % 256 AS VARCHAR(3)) + '.' + CAST(SUM(v) % 256 AS VARCHAR(3)) [Netmask]
    ,CAST(((SUM(v) ^ 0xFFFFFFFF) / 256 / 256 / 256) % 256 AS VARCHAR(3)) + '.' + CAST(((SUM(v) ^ 0xFFFFFFFF) / 256 / 256) % 256 AS VARCHAR(3)) + '.' + CAST(((SUM(v) ^ 0xFFFFFFFF) / 256) % 256 AS VARCHAR(3)) + '.' + CAST(((SUM(v) ^ 0xFFFFFFFF)) % 256 AS VARCHAR(3)) [Wildcard]
    ,CAST(((@AddressValue & SUM(v)) / 256 / 256 / 256) % 256 AS VARCHAR(3)) + '.' + CAST(((@AddressValue & SUM(v)) / 256 / 256) % 256 AS VARCHAR(3)) + '.' + CAST(((@AddressValue & SUM(v)) / 256) % 256 AS VARCHAR(3)) + '.' + CAST(((@AddressValue & SUM(v))) % 256 AS VARCHAR(3)) + '/' + CAST(MAX(b) AS VARCHAR(2)) [NetworkAddress]
    ,CAST(((((SUM(v) ^ 0xFFFFFFFF)) | @AddressValue) / 256 / 256 / 256) % 256 AS VARCHAR(3)) + '.' + CAST(((((SUM(v) ^ 0xFFFFFFFF)) | @AddressValue) / 256 / 256) % 256 AS VARCHAR(3)) + '.' + CAST(((((SUM(v) ^ 0xFFFFFFFF)) | @AddressValue) / 256) % 256 AS VARCHAR(3)) + '.' + CAST(((((SUM(v) ^ 0xFFFFFFFF)) | @AddressValue)) % 256 AS VARCHAR(3)) [BroadcastAddress]
    ,CAST(((@AddressValue & SUM(v)) / 256 / 256 / 256) % 256 AS VARCHAR(3)) + '.' + CAST(((@AddressValue & SUM(v)) / 256 / 256) % 256 AS VARCHAR(3)) + '.' + CAST(((@AddressValue & SUM(v)) / 256) % 256 AS VARCHAR(3)) + '.' + CAST(((@AddressValue & SUM(v))) % 256 + 1 AS VARCHAR(3)) [FirstHost]
    ,CAST(((((SUM(v) ^ 0xFFFFFFFF)) | @AddressValue) / 256 / 256 / 256) % 256 AS VARCHAR(3)) + '.' + CAST(((((SUM(v) ^ 0xFFFFFFFF)) | @AddressValue) / 256 / 256) % 256 AS VARCHAR(3)) + '.' + CAST(((((SUM(v) ^ 0xFFFFFFFF)) | @AddressValue) / 256) % 256 AS VARCHAR(3)) + '.' + CAST(((((SUM(v) ^ 0xFFFFFFFF)) | @AddressValue)) % 256 - 1 AS VARCHAR(3)) [LastHost]
    ,(((SUM(v) ^ 0xFFFFFFFF)) | @AddressValue) - (@AddressValue & SUM(v)) - 1 [TotalHostCount]
    FROM bits WHERE @Mask BETWEEN 1 AND 32 AND b <= @Mask
    Jon

  • Help w/MaxDB Function; also: how does the "Debug SQL" function work?

    Hi there forum folks,
    In my former life, I was a Basis guy, but I haven't had the pleasure of working directly with SAP applications in a few months.  My current project is to attempt to use MaxDB in a real estate environment.  We're tracking home listings so that we can build statistical reports... such as "what agents are in the Top 100 in postal code X?"
    Anyway, as part of this project, I have attempted to construct my very first MaxDB database function.  Unfortunately, it doesn't give me the answers I'm hoping to see.  Here's the function:
    CREATE FUNCTION COUNT_LISTINGS (AGENTID CHAR(10)) RETURNS FIXED(6,1) AS
      VAR COLISTINGAGENTID CHAR(10);
          LISTINGAGENTID   CHAR(10);
          MLSNUMBER        CHAR(7);
          UNITS            FIXED(6,1);
      SET UNITS = 0;
      DECLARE FUNCTIONRESULT CURSOR FOR
        SELECT MLSNUMBER,
               LISTINGAGENTID,
               COLISTINGAGENTID FROM FREDDIE.GLAR_SOLDS
         WHERE LISTINGAGENTID = :agentid OR COLISTINGAGENTID = :agentid;
      IF $COUNT IS NULL THEN
        BEGIN
          CLOSE FUNCTIONRESULT;
          RETURN UNITS;
        END
      ELSE
        SET $RC = 0;
      WHILE $RC = 0 DO BEGIN
        FETCH FUNCTIONRESULT INTO :mlsnumber, :listingagentid, :colistingagentid;
        IF ( LISTINGAGENTID   = AGENTID AND COLISTINGAGENTID IS NULL ) OR
           ( COLISTINGAGENTID = AGENTID AND LISTINGAGENTID   IS NULL ) THEN
          SET UNITS = UNITS + 1
        ELSE
          SET UNITS = UNITS + 0.5;
      END;
    CLOSE FUNCTIONRESULT;
    RETURN UNITS;
    I've tried to follow the official MaxDB documentation.  My first deviation from that standard was the use of the "$COUNT" variable (instead of the "$RC" variable) immediately after the DECLARE/SELECT statement above.  When I tried to use $RC, for either a successful or unsuccessful query, $RC was always set to a non-zero value.
    I believe I'm past that, but now my issue is down around that FETCH statement.  The UNITS variable doesn't end up with the value I expect.  I know that it can be terribly confusing to try to analyze someone else's logic, but here's a brief narrative that describes what I'm trying to do...
    The GLAR_SOLDS table holds one line for each home sold.  It's keyed by the MLSnumber.  Each record also stores up to four agents who've been involved in the transaction: the listing agent, the co-listing agent, the selling agent, and the co-selling agent.  The database function I've written above pertains to the listing side only.  If I can get this to work, a separate function will process the selling side.  If no co-listing agent is involved in a given sell, that agent should get credit for 1 unit sold.  If he/she has help from a co-listing agent, the agent should only get credit for 1/2 unit sold.
    Also, does anyone know how the "Debug SQL" functionality is supposed to work within Database Studio?  When I right-mouse click on my function, and follow the path thru "Debug As...", after entering the connection & function arguments, I'm presented with an empty screen.  If you could point me to some documentation somewhere, I'd gratefully read it.
    I'm using MaxDB 7.7.06.09 on Windows XP (WIN32) with MaxDB Database Studio 7.7.06.09 (build 009-123-202-944).
    Thanks everyone for your help & advice.
    ~Fred

    Fred,
    please either provide the full SQL statements for your example or stick with mine.
    I'm not going to build it up myself a second time to suit yours now.
    >  But now, my issue is how do I store the resultant data in its own table?
    So where is the problem?
    INSERT INTO <target table> (field 1, field 2, ...)  (<your query>)  UDPATE DUPLICATES-
    With my tables this looks like this:
    create table sell_result (list_agent varchar(20) primary key, SUM_CREDIT fixed (10,2))
    insert
    into sell_result (list_agent,sum_credit)
        ( select list_agent, sum (credit) as SUM_CREDIT
          from ( select sh.object_id,lag.name as list_agent, 1 as credit
                 from soldhomes sh join agents lag on lag.id = sh.list_agent_id
                union all
                 select sh.object_id, lag.name as list_coagent, 0.5 as credit
                 from soldhomes sh join agents lag on lag.id = sh.list_coagent_id
          group by list_agent
    update duplicates
    Check what we have now
    sqlcli db770=> select * from sell_result
    | LIST_AGENT           | SUM_CREDIT        |
    | -------------------- | ----------------- |
    | Lars                 |              4.50 |
    | Lisa                 |              3.00 |
    | Mona                 |              2.50 |
    | Paul                 |              2.50 |
    4 rows selected (600 usec)
    Now add some sales data...
    Insert into soldhomes values (11, 1, 2, NULL, NULL)
    Insert into soldhomes values (12, 2, NULL, NULL, NULL)
    Insert into soldhomes values (13, 2, NULL, NULL, NULL)
    Re-run the INSERT command and you're done:
    sqlcli db770=> select * from sell_result
    | LIST_AGENT           | SUM_CREDIT        |
    | -------------------- | ----------------- |
    | Lars                 |              5.50 |
    | Lisa                 |              3.00 |
    | Mona                 |              5.00 |
    | Paul                 |              2.50 |
    4 rows selected (390 usec)
    Neat, isn't it?

  • How to debug a remote function module in calling system? Help!

    Hi Experts,
       I have a ABAP report (in System A) from where I am calling a remote function module which exists in a different system B.
    ABAP Program(System A)<----calls--
    RFC(System B)
    Can I debug the RFC funnction module in system A using ABAP debugger? In other words if i put a breakpoint on the "call function" statement then in debug mode I want to see that the control is going to system B and I should be able to process the FM code line by line. Is this possible?
    Is there any special transaction or settings?
    Is there any alternative?
    Please help
    Thanks
    Gopal

    hello,
    Try this method.
    first check whether RFC connection is working b/w 2 systems.
    if connection is working, then do like this.
    In System B , put endless loop in FM before some main select statement.
    like
    DATA : v_a TYPE c VALUE space
    DO  .
       IF v_a = 'X'.
         EXIT.
       ENDIF.
    ENDDO.
    the above code will be endleep loop.
    In system A, when cursor goes to CALL FUNCTION DESTINATION 'XXXXX'.
    u shud be logged in system B. the moment control comes to system B.goto tcode SM50 . check ur username . choose that particular  checkbox then in menu bar --> program/session --> Program --> Debugging.
    i hope it will help u.
    try & let us know.
    Thanks,
    Manjunath MS

  • Calling pl/sql function in CKM...pls help

    Hi,
    I have made a call to PL/SQL function in CKM customization. The code is :
    declare
    L_PMG_VALUE VARCHAR(3);
    begin
    L_PMG_VALUE:='PMG';
    VALIDATE_PMG_VALUE(L_PMG_VALUE);
    end;
    When i run it, it throws error which says:
    6550 : 65000 : java.sql.SQLException: ORA-06550: line 1, column 64:
    PLS-00221: 'VALIDATE_PMG_VALUE' is not a procedure or is undefined
    ORA-06550: line 1, column 64:
    PL/SQL: Statement ignored
    Function is compiled in the database and its working. I have selected the Technology as Oracle and correct Schema Name.
    Please help

    Hi,
    try the following way. i have not tried ....i think it helps you.
    In which schema you have created that procedure.
    Does the ODI user mantioned in topology have execute permissions on the procedure? if the ODI user have execute previlage on the procedure then in CKM customisation call the procedure like <schema>.<procedure>.
    Please let me know any issues.
    Thanks,

  • How to debug a Package / function in PL SQL developer ??

    How can we debug a Package / function in PL SQL developer ??
    i want to debug a code line by line

    Karthick_Arp wrote:
    This question does not belong to this fourm. We have a {forum:id=260} forum for such question.Not even there Karthick. PL/SQL Developer is a 3rd party tool, not Oracle's SQL Developer, so it doesn't even belong on the Oracle forums.

  • PL/SQL function debugging in NetBeans

    Hello.
    I have a PL/SQL function which I call from my JDBC code (the Java application is being developed using NetBeans). My function takes many arguments of different types. When I test it using SQL*Plus it works fine. When I call the function from the java code -- it does not work.
    What is the right way to debug my PL/SQL function once it is called from the Java application?
    Thank you!
    Mark.

    Make sure your parameters for the callable statement are registered correctly. Here is an example of a call made to an oracle function called "my_function" that returns a cursor:
    CallableStatement callst = conn.prepareCall("{call ? := my_function(?)}");
    callst.registerOutParameter(1, OracleTypes.CURSOR);
    callst.setInt(2,999);  //999 is the value being passed in
    callst.executeUpdate(); Post the error message you are getting in java, if it works fine from the SQL prompt then it must be java.

  • SQL function help

    Hi, I am trying to write a sql query to replace the string starting with '<' with NULL. Right now I am using CASE statement to replace with NULLs. Is there any function to replace with NULLs for all the strings starting with '<%'.
    Example:
    CASE When field_name LIKE '<%' then NULL else field_name
    (before) After
    <NA> NULL
    <UK> NULL
    I want to replace the above sql suery with a single sql function without using CASE statements.
    I tried to use REPLACE function, but it replaces only single character. I want to replace the whole string
    Thanks in advance.

    Hi,
    Adam Martin posted a good solution. I hope that it is clear to you that you have to replace the string '<NA>' with your column(s).
    I.e.:
    SELECT REGEXP_REPLACE (a.col1, '^<.?+', '') AS col1
         , REGEXP_REPLACE (a.col2, '^<.?+', '') AS col2
      FROM table1 a;
    {code}
    You can use also the DECODE and SUBSTR functions to have the same result:
    The code below will get the first character with SUBSTR function and the DECODE function will return NULL if the value of the first character is "<" otherwise the value of the column.
    {code:sql}
    SELECT DECODE(SUBSTR(a.col1,1,1),'<', NULL, a.col1) AS col1
         , DECODE(SUBSTR(a.col2,1,1),'<', NULL, a.col2) AS col2
      FROM table1 a;
    {code}
    but using REGEXP_REPLACE is easier to write.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Problem when calling a return type BOOLEAN SQL Function in a package

    Hi All,
    I am having problem when trying to call a SQL function in a package with return type BOOLEAN
    The SQL function signature is as follows
    CREATE OR REPLACE PACKAGE RMSOWNER.ORDER_ATTRIB_SQL ****
    FUNCTION GET_PO_TYPE_DESC(O_error_message IN OUT VARCHAR2,
    I_PO_TYPE       IN     VARCHAR2,
    O_PO_TYPE_DESC  IN OUT VARCHAR2)
    RETURN BOOLEAN;
    Following is my java code
    +CallableStatement cs3 = conn.prepareCall("{?=call ORDER_ATTRIB_SQL.GET_PO_TYPE_DESC(?,?,?)}");+
    +cs3.registerOutParameter(1, java.sql.Types.BOOLEAN);+
    +cs3.registerOutParameter(2, java.sql.Types.VARCHAR);+
    +cs3.registerOutParameter(4, java.sql.Types.VARCHAR);+
    +cs3.setString(2, "");+
    +cs3.setString(3, "ST");+
    +cs3.setString(4, "");+
    +ResultSet rs3 = cs3.executeQuery();+
    I get the following exception, i tried changing the sql type(registerOutParameter) from boolean to bit but i still getting this exception.
    But when i call any other functions with return type other than boolean they work perfectly fine.
    Please can anyone help me fix this issue, i am not sure if its anything to do with vendor JDBC classes?
    +java.sql.SQLException: ORA-06550: line 1, column 13:+
    +PLS-00382: expression is of wrong type+
    +ORA-06550: line 1, column 7:+
    +PL/SQL: Statement ignored+
    +     at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)+
    +     at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)+
    +     at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)+
    +     at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)+
    +     at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:215)+
    +     at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:954)+
    +     at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168)+
    +     at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3316)+
    +     at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3422)+
    +     at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4394)+
    #####

    Hello People!
    There is another workaround!!
    See the example below:
    private String callBooleanAPi(String tableName,String apikey,String dtInicio,String dtFim,String comando) throws SQLException {
                   CallableStatement cs = null;
                   String call = "";
                   String retorno = null;
                   try {
                        if(comando.equalsIgnoreCase("INSERT")){
                             call = "declare x BOOLEAN; y varchar2(2);begin x :=PKG.INSERT(?,?,?,?,?); if x then y := 'S'; else y :='N'; end if; ? := y;end;";
                        } else if(comando.equalsIgnoreCase("UPDATE")){
                             call = "declare x BOOLEAN; y varchar2(2);begin x := PKG.UPDATE(?,?,?,?,?); if x then y := 'S'; else y :='N'; end if; ? := y;end;";
                        } else if(comando.equalsIgnoreCase("DELETE")){
                             call = "declare x BOOLEAN; y varchar2(2);begin x := PKG.DELETE(?,?,?,?,?); if x then y := 'S'; else y :='N'; end if; ? := y;end;";
                        cs = conn.prepareCall(call);
                        SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
                        SimpleDateFormat sdfToSqlDate = new SimpleDateFormat("yyyy-MM-dd");
                        java.util.Date dataInicialVigencia =null;
                        java.util.Date dataFinalVigencia = null;
                        Date dtInicialFormatada =null;
                        Date dtFinalFormatada = null;
                        if(dtInicio != null && !dtInicio.equals("")){
                             dataInicialVigencia = sdf.parse(dtInicio);
                             dtInicio =sdfToSqlDate.format(dataInicialVigencia);
                             dtInicialFormatada = Date.valueOf(dtInicio);
                        if(dtFim != null && !dtFim.equals("")){
                             dataFinalVigencia = sdf.parse(dtFim);
                             dtFim =sdfToSqlDate.format(dataFinalVigencia);
                             dtFinalFormatada = Date.valueOf(dtFim);
                        cs.setString(1, tableName);
    cs.setString(2, apikey);
    cs.setDate(3, dtInicialFormatada );
    cs.setDate(4, dtFinalFormatada );
    cs.registerOutParameter(5, java.sql.Types.VARCHAR);
    cs.registerOutParameter(6, java.sql.Types.VARCHAR );
    cs.execute();
                        retorno = cs.getString(6);
                        System.out.println( cs.getString(5));
                   } catch(SQLException e){
                   throw new SQLException("An SQL error ocurred while calling the API COR_VIGENCIA: " + e);
                   } catch(Exception e){
                   Debug.logger.error( "Error calculating order: " + id, e );
                   } finally {
                   if (cs != null) {
                   cs.close();
                   cs = null;
                   return retorno;
    As you can see the CallableStatement class acepts PL/SQl blocks.
    Best Regards.

  • Debugging PL/SQL blocks in SQL Developer

    Is there any way to debug blocks of PL/SQL in SQL Developer by setting breakpoints in the code? I'm using SQL Developer.
    I'm trying to debug some fairly complex PL/SQL blocks - they are not procedures or functions and so I'm unable to run them in debug mode.
    p.s. Apologies should have posted this in the database forum really.
    Edited by: Antilles on Sep 10, 2008 1:12 AM

    Hello,
    Sure you can, take a look at the following two links -
    http://sueharper.blogspot.com/2006/07/remote-debugging-with-sql-developer_13.html
    http://www.oracle.com/technology/oramag/oracle/08-may/o38browser.html
    Hope this helps,
    John.
    http://jes.blogs.shellprompt.net
    http://www.apex-evangelists.com

Maybe you are looking for

  • Error deploying 10.1.3 application to App server 10.1.3

    Hi, I have an application (JSP, Struts, ADF BC) created in Jdev 10.1.3 and works fine on my local OC4J server. But when I deployed it to OAS 10.1.3, I got the following error: oracle.jbo.InvalidDefNameException: JBO-25004: Definition name view/DataBi

  • My computer doesn't see my external hard drive

    Hello. I have a Power Mac G4, X10.4.6 and for a long time I've used it successfully with my hard drice - and Icecube 800 hard drive connected through a firewire cable. Now i just formated the intern hard disks and now the computer doesn't see the har

  • How do I open up photoshop CC in the Creative Cloud

    I have downloaded the Creative Cloud and have photoshop CC in "my Apps.  I have watched several tutorials and want to launch it to practice what I have learned. How do I launch my trial version of photoshop?  It is not in my application folder as it

  • Do I need to compress my MOV files?

    I have a Canon Rebel camera that records HD video. All I want to do is upload video files about 10 mins in length on average, and about 3 GB to youtube. But the estimated times for uploading is 560 minutes. Some quick google searches and I get the im

  • How to display selected options in lookup F4  query selection screen

    i have to provide selected options  infoprovider specific than all values from database.