"umeric or value error" in user function

Hello everyone,
I wrote a very simple function which purpose is to format a Date (e.g. 31-12-2011) into this form: 2011-12
create or replace function inv_date (v_billing_month date)
return number is
begin
return to_char(v_billing_month,'yyyy-mm');
end inv_date;
The function is compiled without errors. But when I use the following skript I get an error:
select
inv_date(billing_month)
from bl_invdtl;
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
To Problem seems to be, that the SQL-Statement expects a Date and not a character.
How can I avoid this error? Because the to_char() function generaly can do this.
Edited by: user10943421 on 01.02.2012 00:21

create or replace function inv_date (v_billing_month date)
return varchar2 is
begin
return to_char(v_billing_month,'yyyy-mm');
end inv_date;

Similar Messages

  • PL/SQL function body returning SQL query - ORA-06502: PL/SQL: numeric or value error

    I'm attempting to dynamically generate a rather large SQL query via the "PL/SQL function body returning SQL query" report region option.  The SQL query generated will possibly be over 32K.  When I execute my page, I sometimes receive the "ORA-06502: PL/SQL: numeric or value error" which points to a larger than 32K query that was generated.  I've seen other posts in the forum related to this dynamic SQL size limitation issue, but they are older (pre-2010) and point to the 32K limit of the DNS (EXECUTE IMMEDIATE) and DBMS_SQL.  I found this post (dynamic sql enhancements in 11g) which discusses 11g no longer having the 32K size limitation for generating dynamic SQL.  Our environment is on 11gR2 and using ApEx 4.2.1.  I do not know which dynamic SQL method -- DNS or DBMS_SQL -- ApEx 4.2.1 is using.  Can someone clarify for me which dynamic SQL method ApEx uses to implement the "PL/SQL function body returning SQL query" option?
    As a test, I created a page on apex.oracle.com with a report region with the following source:
    declare
      l_stub varchar2(25) := 'select * from sys.dual ';
      l_sql  clob := l_stub || 'union all ';
      br     number(3) := 33;
    begin
      while length ( l_sql ) < 34000 loop
        l_sql := l_sql || l_stub || 'union all ';
      end loop;
      l_sql := l_sql || l_stub;
      for i in 1 .. ceil ( length ( l_sql ) / br ) loop
        dbms_output.put_line ( dbms_lob.substr ( l_sql, br, ( ( i - 1 ) * br ) + 1 ) );
      end loop;
      return l_sql;
    end;
    The dbms_output section is there to be able to run this code in SQL*Plus and confirm the size of the SQL is indeed larger than 32K.  When running this in SQL*Plus, the procedure is successful and produces a proper SQL statement which can be executed.  When I put this into the report region on apex.oracle.com, I get the ORA-06502 error.
    I can certainly implement a work-around for my issue by creating a 'Before Header' process on the page which populates an ApEx collection with the data I am returning and then the report can simply select from the collection, but according to documentation, the above 32K limitation should be resolved in 11g.  Thoughts?
    Shane.

    What setting do you use in your report properties - especially in Type and in Region Source?
    If you have Type="SQL Query", then you should have a SELECT statement in the Region Source. Something like: SELECT .... FROM ... WHERE
    According to the ERR-1101 error message, you have probably set Type to "SQL Query (PL/SQL function body returning SQL query)". In this situation APEX expects you to write a body of a PL/SQL function, that will generate the text of a SQL query that APEX should run. So it can be something like:
    declare
    mycond varchar2(4000);
    begin
    if :P1_REPORT_SEARCH is not null THEN
    mycond:='WHERE LAST_NAME like :P1_REPORT_SEARCH ||''%''';
    end if;
    return 'select EMPLOYEE_ID, FIRST_NAME, LAST_NAME from EMPLOYEES ' ||mycond;
    end;
    And for escaping - are you interested in escaping the LIKE wildcards, or the quotes?
    For escaping the wildcards in LIKE function so that when the user enters % you will find a record with % and not all functions, look into the SQL Reference:
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/conditions007.htm
    (You would than need to change the code of your function accordingly).
    If you are interested in escaping the quotes, try to avoid concatenating the values entered by the user into the SQL. If you can, use bind variables instead - as I have in my example above. If you start concatenating the values into the text of SQL, you are open to SQLInjection - user can enter anything, even things that will break your SQL. If you really need to allow users to choose the operator, I would probably give them a separate combo for operators and a textfield for values, than you could check if the operator is one of the allowed ones and create the condition accordingly - and than still use bind variable for inserting the filtering value into the query.

  • More "TypeError: Error #1006: value is not a function." trouble

    var pntClk:int = -1;
    for(var t:int=0;t<tab1PointsArray.length;t++) {
         tab1PointsArray[t].addEventListener(MouseEvent.CLICK, tab1PointClicked); <Problem code i think. Error points to line 117
         trace("Event listener added to " + tab1PointsArray[t].name);
    function tab1PointClicked (event:MouseEvent):void {
         for(var T:int=0;T< tab1PointsArray.length;T++) {
              if (event.currentTarget == tab1PointsArray[T]) {
                   pntClk = T;
                   openInfoTab();
                   trace("Point Clicked: " +  tab1PointsArray[T].name);
    I wrote some previous code that worked and i copy pasted over to this project and it doesn't work.
    The weird part to me is that it still runs the first set of trace statements (there are 8 objects in that array). But, it won't run the second set...
    for(var l:int=0;l<Tab2PointsArray.length;l++) {
         Tab2PointsArray[l].addEventListener(MouseEvent.CLICK, tab2PointClicked);
         trace("Event listener added to " + Tab2PointsArray[l].name);
    function tab2PointClicked (event:MouseEvent):void {
         for(var t:int=0;t< Tab2PointsArray.length;t++) {
              if (event.currentTarget ==  Tab2PointsArray[t]) {
                   pntClk = t;
                   openInfoTab();
                   trace("Point Clicked: " +  Tab2PointsArray[t].name);
    if you need more code or info to help me figure this out let me know
    I don't know actionscript that well so bare with

    The output window:
    Event listener added to PointHitch
    Event listener added to PointPTO
    Event listener added to PointSafety
    Event listener added to PointGearBox
    Event listener added to PointBlade
    Event listener added to PointTeeth
    Event listener added to PointGrapple
    TypeError: Error #1006: value is not a function.
    at TractorSawFlash_fla::MainTimeline/frame1()[TractorSawFlash_fla.MainTimeline::frame1:115]
    I think the first set of listeners is added then the error happens and the second set of listeners doesn't get added.
    Here is more code.
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    import flash.events.MouseEvent;
    var infoTabIsOpen:Boolean = false;
    //TAB CODE
    var TractorSawTabToggle:Boolean = false;
    var TabButtonArray:Array = new Array(TabTR3200.TR3200BTN, TabTR3200LT.TR3200BTNLT);
    for (var i:int=0; i<TabButtonArray.length; i++)
         TabButtonArray[i].id = i;
         TabButtonArray[i].addEventListener(MouseEvent.CLICK, onClick);
    TabTR3200.TR3200BTN.mouseEnabled = false;
    TabTR3200.TR3200BTN.buttonMode = false;
    function onClick(event:MouseEvent):void{
         if (TractorSawTabToggle == true) {
              TractorSawTabToggle = false;
              swapChildren(this.TabTR3200,this.TabTR3200LT);
              TabTR3200LT.TR3200BTNLT.mouseEnabled = true;
              TabTR3200LT.TR3200BTNLT.buttonMode = true;
              TabTR3200.TR3200BTN.mouseEnabled = false;
              TabTR3200.TR3200BTN.buttonMode = false;
         else {
              TractorSawTabToggle = true;
              swapChildren(this.TabTR3200,this.TabTR3200LT);
              TabTR3200LT.TR3200BTNLT.mouseEnabled = false;
              TabTR3200LT.TR3200BTNLT.buttonMode = false;
              TabTR3200.TR3200BTN.mouseEnabled = true;
              TabTR3200.TR3200BTN.buttonMode = true;
    //END TAB CODE
    //MovieTab
    MovieButton.addEventListener(MouseEvent.CLICK, clickedMainMovie);
    MovieTab.Exit_BTN.addEventListener(MouseEvent.MOUSE_DOWN, outMainMovieTrigger);
    function clickedMainMovie(event:MouseEvent):void {
         var TabMainMovieDown:Tween = new Tween(MovieTab, "y", Strong.easeOut, -600, 0, 1, true);
         var TabMainMovieAlphaIn:Tween = new Tween(MovieTab, "alpha", Strong.easeOut, 0, 1, 1, true);
         if (infoTabIsOpen == true) {
              closeInfoTab();
    function outMainMovieTrigger(event:MouseEvent):void {
         outMainMovie();
    function outMainMovie():void {
         trace("Three Sixty MOUSE_OUT");
         var TabMainMovieUp:Tween = new Tween(MovieTab, "y", Strong.easeOut, 0, -600, 1, true);
         var TabMainMovieAlphaOut:Tween = new Tween(MovieTab, "alpha", Strong.easeOut, 1, 0, 1, true);
         MovieTab.FLVPlayback.stop();
    //END MovieTab
    //INFO TAB ARRAYS AND FUNCTIONS
    var placeHolder:String = "null";
    var tab1PointsArray:Array = new Array(this.TabTR3200.PointHitch, //0
                                                             this.TabTR3200.PointPTO, //1
                                                             this.TabTR3200.PointSafety, //2
                                                             this.TabTR3200.PointGearBox, //3
                                                             this.TabTR3200.PointBlade, //4
                                                             this.TabTR3200.PointTeeth, //5
                                                             this.TabTR3200.PointGrapple, //6
                                                             placeHolder); //7
    var Tab2PointsArray:Array = new Array(this.TabTR3200LT.PointHitch, //0
                                                              this.TabTR3200LT.PointPTO, //1
                                                              this.TabTR3200LT.PointSafety, //2
                                                              this.TabTR3200LT.PointGearBox, //3
                                                              this.TabTR3200LT.PointBlade, //4
                                                              this.TabTR3200LT.PointTeeth, //5
                                                              placeHolder, //6
                                                              this.TabTR3200LT.PointPushingBar);//7
    var pictureArray:Array = new Array(placeHolder,
                                                       placeHolder,
                                                       placeHolder,
                                                       placeHolder,
                                                       placeHolder,
                                                       placeHolder,
                                                       placeHolder,
                                                       placeHolder);
    var textArray:Array = new Array(InfoTab.txtHitch, //0
                                                   InfoTab.txtPTO, //1
                                                   InfoTab.txtSafety, //2
                                                   InfoTab.txtGearbox, //3
                                                   InfoTab.txtBlade, //4
                                                   InfoTab.txtTeeth, //5
                                                   InfoTab.txtGrapple, //6
                                                   InfoTab.txtPushingBar); //7
    //Point Clicked Code
    var pntClk:int = -1;
    for(var t:int=0;t<tab1PointsArray.length;t++) {
         tab1PointsArray[t].addEventListener(MouseEvent.CLICK, tab1PointClicked); <LINE 115 were it says the error is happening
         trace("Event listener added to " + tab1PointsArray[t].name);
    function tab1PointClicked (event:MouseEvent):void {
         for(var T:int=0;T< tab1PointsArray.length;T++) {
              if (event.currentTarget == tab1PointsArray[T]) {
                   pntClk = T;
                   openInfoTab();
                   trace("Point Clicked: " +  tab1PointsArray[T].name);
    for(var l:int=0;l<Tab2PointsArray.length;l++) {
         Tab2PointsArray[l].addEventListener(MouseEvent.CLICK, tab2PointClicked);
         trace("Event listener added to " + Tab2PointsArray[l].name);
    function tab2PointClicked (event:MouseEvent):void {
         for(var t:int=0;t< Tab2PointsArray.length;t++) {
              if (event.currentTarget ==  Tab2PointsArray[t]) {
                   pntClk = t;
                   openInfoTab();
                   trace("Point Clicked: " +  Tab2PointsArray[t].name);
    //Info Tab
    var ImageLoader:Loader;
    ImageLoader = new Loader();
    // make text invisible
    function makeTextInvisible():void {
         for (var txt:int=0; txt<textArray.length; txt++) {
              textArray[txt].visible = false;
    InfoTab.Exit_BTN.buttonMode = true;
    InfoTab.Exit_BTN.addEventListener(MouseEvent.CLICK, closeInfoTrigger);
    function closeInfoTrigger(e:MouseEvent):void {
         trace("close feature triggered");
         closeInfoTab();
    //OPEN INFO TAB
    function openInfoTab():void {
         //EnableExitButton
         var EnableExitButton:Timer = new Timer(333, 1);
         InfoTab.mouseEnabled = true;
         InfoTab.mouseChildren = true;
         var tabIn:Tween = new Tween(InfoTab, "y", Regular.easeOut, 600, 60, 10, false);
         var tabAlphaIn:Tween = new Tween(InfoTab, "alpha", Regular.easeOut, 0, 1, 10, false);
         //pictureSetter
         if (pictureArray[pntClk] != "null") {
              ImageLoader.load(new URLRequest(pictureArray[pntClk]));
              this.InfoTab.ImageHolder_MC.addChild(ImageLoader);
         textArray[pntClk].visible = true;
         infoTabIsOpen = true;
    //end open info tab
    //CLOSE INFO TAB
    function closeInfoTab():void{
         //deactivating setters
         InfoTab.mouseEnabled = false;
         InfoTab.mouseChildren = false;
         trace("feature tab deactivated");
         //unload picture
         if (pictureArray[pntClk] != "null") {
              ImageLoader.unload();
              this.InfoTab.ImageHolder_MC.removeChild(ImageLoader);
              ImageLoader = null;
         //tab action variables
         var tabAlphaOut:Tween = new Tween(InfoTab, "alpha", Regular.easeIn, 1, 0, 8, false);
         var tabOut:Tween = new Tween(InfoTab, "y", Regular.easeIn, 60, 600, 8, false);
         infoTabIsOpen = false;
         //exit timer
         var exitTimer:Timer = new Timer(200, 1);
         exitTimer.addEventListener(TimerEvent.TIMER, exitHandler);
         exitTimer.start();
         function exitHandler(event:TimerEvent):void
              trace("exit handler fired");
              makeTextInvisible();
         //end exit timer
         pntClk = -1;
    //end closeFeatureTab

  • Error #1006: value is not a function

    I'm trying to port a big library to Alchemy. I've run into something that looks like an Alchemy bug. I have a class with a static member. There's a static function that uses it. Something like this:
    In foo.h:
        class Foo
            static Bar m_pBar;
            static void doSomething (int a);
    In foo.cpp:
        Bar Foo::m_pBar;
        void Foo::doSomething (int a)
            m_pBar.doSomething(a);
    When I do Foo::doSomething(a), I get TypeError: Error #1006: value is not a function.
    On the other hand, if I use a local variable of the same type in the static function (just to test), it works :
        void Foo::doSomething (int a)
            // Test
            Bar pBarTest;
            pBarTest.doSomething(a);
    So my guess is that the static variable is not being initialized. This works fine when compiled with g++ in Linux and Mac and with Visual C++ 2008 in Windows so it looks like Alchemy is doing something wrong.
    Has anyone encountered this same issue?

    Ignore, it was something in the called class, oops

  • If there is no error in procedure/function, what is  value for SQLCODE..?

    Hi all...
    If there is no error in procedure/function, what is value for SQLCODE..?
    I Think, 0 (zero) is the default value for SQLCODE
    and default value for all other varaibles in PL/SQL is NULL. I am right or wrong...?
    Thanks in advance,
    Pal
    Message was edited by:
    user546710

    why not test?
    DECLARE
    err_code NUMBER(9);
    BEGIN
        err_code := SQLCODE;
        DBMS_OUTPUT.PUT_LINE(err_code);
    END;                                                                                                                                                                                                                                                           

  • Need to raise an error if Users puts wrong value for date datatype in Forms

    Hi all,
    I've created a new form using Template.fmb in forms 10g having some text item with data type as DATE.
    and now i wanted to raise an error if users inputs any wrong data rather than DATE format.
    Please help me if anyone knows how to do this...

    b_kapsy wrote:
    As of now i am not looking for validation, i know the validation will automatically done but if you see by default it will not raise any error message if you fill any wrong value in text item with date data type. It will freeze the cursor to the text item.That is NOT the default. The default is to issue various FRM-nnnnn messages, between 50002 and 50026. From notes I have:
    -- 50002: Month must be between 1 and 12.
    -- 50003: Year must be 00-99 or 1000-4712
    -- 50004: Day must be between 1 and last of month.
    -- 50012: Date must be entered in a format like <fxMMDDRR>
    -- 50017,18,19: Hour,Min,Sec must be between 0 and 23,59,59.
    -- 50025: Date/time must be entered in a format like <xxyytttt>
    -- 50026: same as 50012 and 50025 with <yyyy> year.
    And from my old, dusty copy of the Oracle Developer/2000 "Messages and Codes Manual", those messages have an error level = 15.
    If you are not seeing those messages, then you have done one of two things:
    1. Set your System.Message_Level to a value of 15 or higher. You should NEVER set it above zero, since all that does is hides error messages like these. If you want to bypass or prevent an error message, it should be handled in the Re: FRM-40735:Pre_Insert trigger raised unhandled exception ORA-20011.
    2. You have some bad code in an On-Error trigger that fails to handle errors correctly.

  • Invalid function body condition: ORA-06502: PL/SQL: numeric or value error:

    I'm trying to customize my link column on an interactive report to branch to another page in my application based on a pl/sql call. My condition type for the link column is pl/sql function body returning a boolean. I'm calling a packaged function that returns a boolean but receive the following error:
    Invalid function body condition: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    This is my code:
    return files_util.list_files('test','test');
    I've tried running the same code in sqlplus and it works fine. Any help would be appreciated.
    Thanks,
    Rob

    It turns out I had multiple issues. I thought the code I was running for the link column would be executed and let me branch to another page to view the results of my pl/sql code. It appears that the pl/sql code for the link column only controls whether the link is displayed or not. The reason for the ora-6502 was because a variable in my pl/sql function was not large enough to hold a value based on the userid signing onto the application. I'm using database authentication so I thought that the userid in apex would be my database userid which is only 4 characters. The userid actually used is apex_public_user which caused by ora-6502 error.

  • How to export values to a user defined function

    Hi Experts,
    I want to create a function module under FUNCTION EXIT_SAPMIWO0_020.How to access these values into the called function?
    I tried it using IMPORT parameters of the called function.But while debugging I am not getting these values.
    Can any1 suggest a solution for this problem?
    Regards,
    Sam.

    > Earlier I was using RFC enabled function module for sending the mail under FUNCTION EXIT_SAPMIWO0_020
    You were using aRFC (starting new task: it starts immediately and asynchronously), not tRFC (transactional RFC: it starts only at the end of COMMIT WORK).
    > and the mail was getting delivered instantly.
    It was only because you were using RSCONN01 (preceded by commit of course), not because of the aRFC.
    > Here also I am using COMMIT WORK before
    > SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
    Well that's very strange it doesn't send the mail immediately! (see my answer below)
    Note that it is dangerous (for many reasons I don't need to explain here) to run COMMIT WORK, SUBMIT, and a few other statements, in a BAdI, especially when it's at save time. Prefer to use tRFC as I said (and not the aRFC).
    > Also the sent item of the mail in outlook is 50 minutes ahead of our system time
    > Is it the reason for a delay in mail delivery?
    As you call RSCONN01, the delay can only come from something external to SAP. Check the logs in SCOT, to make sure SAP has sent the mail immediately. In the mail you receive, look at the MIME information in the header of the mail, to check the times at which the mail is transferred from a server to another. Ask your administrator to help you.

  • ORA-06502 Error When Calling Function

    Hi,
    We have upgraded Oracle Database Server 9i to 11.1.0.7 and we are now using ODP.NET version 2.112.2.0 instead of 9.2.0.4 dll.
    After the migration, we encountered ORA-06502 problem when we are calling a function from .NET application. We investigated and found that we have to set the parameter size for the return value parameter (varchar2). But there is a strange case that how do we guess the return value size, it can be 5 characters or 5.000 characters. Before 11g Oracle.DataAccess, we do not have that such problem. We were setting the parameter size 225 by default, but ODP.NET was returning 500 characters without any error.
    The question is that how do we guess or know the actual parameter size when we are passing a Return Value parameter to the function?
    Or is there a solution for this behaviour of ODP.NET?
    Thanks.

    Is there a reason you can not set it to the default maximum size for a varchar2 of 32k?
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Oracle.DataAccess.Client;
    using System.Data;
    namespace test_function2
    class Program
    static void Main(string[] args)
    OracleConnection con = new OracleConnection("Data Source=UTF8;User ID=scott;Password=tiger");
    OracleCommand cmd = new OracleCommand("test_return", con);
    cmd.CommandType = CommandType.StoredProcedure;
    OracleParameter test_return = new OracleParameter("test_return", OracleDbType.Varchar2, 32000);
    test_return.Direction = ParameterDirection.ReturnValue;
    cmd.Parameters.Add(test_return);
    OracleParameter test_input = new OracleParameter("test_input", OracleDbType.Varchar2);
    test_input.Direction = ParameterDirection.Input;
    test_input.Value = "blah";
    cmd.Parameters.Add(test_input);
    try
    con.Open();
    cmd.ExecuteNonQuery();
    con.Close();
    Console.WriteLine("{0}", test_return.Value);
    Console.WriteLine("Press Enter to Continue");
    Console.ReadLine();
    catch (OracleException e)
    Console.WriteLine(e.Number);
    Console.WriteLine(e.Message);
    Console.WriteLine("test failed\nPress Enter to Continue");
    Console.ReadLine();
    create or replace function test_return(in_var in varchar2)
    return varchar2 is
    begin
    return lpad(in_var, 4000, 'TEST test') || lpad(in_var, 4000, 'DONE done');
    end test_return;
    /

  • ORA-06502: PL/SQL: numeric or value error While Exporting in Oracle 10g

    Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Export done in AR8MSWIN1256 character set and AL16UTF16 NCHAR character set
    server uses AR8ISO8859P6 character set (possible charset conversion)
    About to export the entire database ...
    . exporting tablespace definitions
    . exporting profiles
    . exporting user definitions
    . exporting roles
    . exporting resource costs
    . exporting rollback segment definitions
    . exporting database links
    . exporting sequence numbers
    . exporting directory aliases
    . exporting context namespaces
    . exporting foreign function library names
    . exporting PUBLIC type synonyms
    . exporting private type synonyms
    . exporting object type definitions
    . exporting system procedural objects and actions
    . exporting pre-schema procedural objects and actions
    . exporting cluster definitions
    . about to export SYSTEM's tables via Conventional Path ...
    . . exporting table DEF$_AQCALL 0 rows exported
    . . exporting table SRC_RQST_SEQ 1 rows exported
    EXP-00091: Exporting questionable statistics.
    . . exporting table SRC_USERS 6 rows exported
    EXP-00091: Exporting questionable statistics.
    . . exporting table SRC_YEAR_LOOKUP 40 rows exported
    EXP-00091: Exporting questionable statistics.
    . . exporting table TENDER_DETAIL_TABLE 36 rows exported
    EXP-00091: Exporting questionable statistics.
    . . exporting table TENDER_MASTER_TABLE 34 rows exported
    EXP-00091: Exporting questionable statistics.
    . . exporting table TENDER_NEW_DETAIL_TABLE 4 rows exported
    EXP-00091: Exporting questionable statistics.
    . exporting synonyms
    . exporting views
    EXP-00056: ORACLE error 6502 encountered
    ORA-06502: PL/SQL: numeric or value error
    LPX-00210: expected '<' instead of 'n'
    ORA-06512: at "SYS.UTL_XML", line 152
    ORA-06512: at "SYS.DBMS_METADATA_INT", line 7195
    ORA-06512: at "SYS.DBMS_METADATA_INT", line 9135
    ORA-06512: at "SYS.DBMS_METADATA", line 1882
    ORA-06512: at "SYS.DBMS_METADATA", line 3707
    ORA-06512: at "SYS.DBMS_METADATA", line 3689
    ORA-06512: at line 1
    EXP-00056: ORACLE error 6502 encountered
    ORA-06502: PL/SQL: numeric or value error
    LPX-00210: expected '<' instead of 'n'
    ORA-06512: at "SYS.UTL_XML", line 152
    ORA-06512: at "SYS.DBMS_METADATA_INT", line 7195
    ORA-06512: at "SYS.DBMS_METADATA_INT", line 9135
    ORA-06512: at "SYS.DBMS_METADATA", line 1882
    ORA-06512: at "SYS.DBMS_METADATA", line 3707
    ORA-06512: at "SYS.DBMS_METADATA", line 3689
    ORA-06512: at line 1
    EXP-00000: Export terminated unsuccessfully
    Plz reply me the appropriate Solution
    Edited by: user8920919 on May 3, 2010 12:27 AM

    hi,
    EXP-00091: Exporting questionable statistics The client character set(NLS_LANG) does not match the server character;
    select parameter,value from nls_database_parameters where parameter like '%CHARACTERSET%';
    and check the client system character set
    - Pavan Kumar N
    - ORACLE OCP - 9i/10g
    https://www.oracleinternals.blogspot.com

  • Internal error in FORM/FUNCTION CKMC_REVALUATE_ENDING_STOCK in position 1 with RC

    Hello SAP Gurus,
    I am getting this error while trying to close a material in Material Ledger Cockpit
    Internal error in FORM/FUNCTION CKMC_REVALUATE_ENDING_STOCK in position 1 with RC
    Message no. C+099
    Procedure
    Please inform your system administrator.
    CKMC reports no inconsistency.
    Does anyone have any suggestion?
    Cheers,
    TD

    Shipa,
    Thanks for your suggestions.  Thanks for taking the time to help.
    I was able to resolve these issues using the following steps in our sandbox/test environments.  I have also included other problems I faced in material ledger month end closing steps for the benefit of readers.
    **** Caution:  Do not do the following steps in production environment.  You will destroy your production data irretrievably.  Material Ledger is unforgiving!!! ***
    1.  For the materials with "Internal Error in Form/Function etc issue, I performed a CKMM in the respective plants changing for 3S to 2S and then did the same in reverse (2S to 3S).  Then ran the ML close.  This seems to have temporarily solved the problem.
    2.  I was also getting a short dump -- either during MMPV or during period close in the cockpit.  The message at both times was "Error in MLCCS ...".  I realized it related to Cost Component Split.  I identified the company codes of the materials that caused the errors, then got all the plants within each of these company codes.  I ran MLCCS_RESET and then MLCCS_Startup in SE38.  Then ran MMPV/ML Close.  This seems to have resolved the issues at least temporarily.
    3.  Occasionally I noticed some "material valuation is inconsistent in valuation area xxxx" error.  I executed steps 1 and 2 above in succession.  This seems to have resolved the issue temporarily.
    4.  There was also the issue of "duplicate entry in CKMLKEV" while performing Single/Multi-Level steps in the closing cockpit.  This pointed to MLCCS.  So I ran step 2 above.  Again this seems to have fixed the issue temporarily.
    I was able to accomplish all of these using the steps above because these were in our test environments.  The reasons as to why these happened are manifold:
    MMPV was not carried out for a long, long, long time in certain plants within a company code.  When ML is active, it is necessary to close previous period.  In cases where MMPV was not carried out for a long time, I ran CKMHELP program to set the material status to 70 for the immediately preceding posting period.  This helped run the ML cockpit for the current/previous periods.
    Users were processing too many transactions with unrealistically large quantities and prices resulting in overflow errors.  I carried out reversal of movements for each process category to reduce the inventory balances to reasonable quantities, and ran MR21 to set the prices correctly.  This helped resolve the overflow issue.
    Reckless, repeated running of CKMM and MLCCS_Reset/MLCCS_Startup also contributed to these problems.  Every time a standard had to be released, but the material status in ML is "30-Quantities and Values entered", would prevent users from doing that. So they resort to CKMM and then reset status using CKMHELP program to set the status to 10 and then release the new cost.  It works, but wreaks havoc on ML as a whole eventually.
    Hope my comments are useful for some!!!
    Cheers,
    TD

  • Calling user function from Interface mapping

    I am getting error "Bad query:ORA-00904: invalid identifier" while calling function in the mapping of an interface.
    Can some one provide the syntax of calling user function from interface mapping.
    Thanks,
    RP

    user452108 wrote:
    Can some one provide the syntax of calling user function from interface mapping.Oracle's Call Iinterface, the OCI, does not work differently when coding using a Dvorak keyboard, or writing code using a pretty pink font in the editor.. or coding the call from an interface mapping (whatever the hell that that is).
    You have 2 types of calls. SQL and PL/SQL.
    To call a function via SQL, it can be done using a the standard cursor interface. E.g.
    select MyFunkyFunction from dualIt will return the function value via a single row with a single column. The standard cursor fetch and close cursor calls are used.
    To call it via PL/SQL, an anonymous PL/SQL block is needed, and the caller needs to use a bind variable to receive the value from the function. The anon block will look as follows:
    begin
      :bindVar := MyFunkyFunction;
    end;Refer to your client's abstract layer for interfacing with the Oracle Call Interface, on how to deal with bind variables.

  • SQL query concat - numeric or value error

    I am getting numeric or value error when concatenating sql script..
    Here is the sample, I have in the stored proc.. firstpart:_ works fine if I comment the secondpart:_. (I modified the query because I am posting in the public forums)
    V_SAMPLEQUERY VARCHAR2(2000);
    firstpart:_
    V_SAMPLEQUERY := '      
    SELECT
    AB.ABCDID AS ABCDID,
    CD.MEMBERID AS MEMBERID,
    CD.FNAME AS FNAME,
    CD.LNAME AS LNAME,
    CD.ACCOUNT AS ACCOUNT,
    EF.ZIP AS ZIP,
    AB.INSERTTIME AS INSERTTIME,
    AB.INSERTBY AS INSERTBY,
    ES.NAME AS STATUS,
    MYFUNCTION(E.ABCDID) AS AMOUNT,
    PA.NAME AS SOUSENAME,
    R.CODE AS BUDGETCODE,
    WX.ACCOUNTID as ACCOUNTID,
    AB.SOMETYPE AS SOMETYPE,
    AB.ACCTREP,
    ED.TYPE AS TYPE,
    AB.NOTES AS NOTES,
    GH.AREACODE || '''' || GH.PHONE_NUMBER AS PHONENUMBER,
    ED.REQUESTEDDATE,
    ED.BOOKED,
    ED.CALLERINFO
    FROM PEOPLES AB,
    LOCATIONS CD,
    LOCATIONTYPES EF,
    ACCOUNTS GH,
    ACCOUNTdetails IJ,
    ACCOUNTstatus KL,
    ACCOUNTMEMBERDETAILS MN,
    MEMBERS OP,
    BUDGET QR,
    BCODES ST,
    ACCOUNTSYSTEM UV,
    INFOCALL WX,
    PHONE_NUMBERS YZ
    WHERE AT.NAME = ''SAVINGS''
    andCD.MEMBERID = PH.MEMBERID
    andCD.MEMBERID =EF.MEMBERID
    and AT.ADDRESSTYPEID =EF.ADDRESSTYPEID
    andCD.MEMBERID =AB.MEMBERID
    andAB.STATUS = ES.STATUS(+)
    andAB.ABCDID = ED.ABCDID
    andAB.ABCDID = EP.ABCDID(+)
    and EP.MEBER_ID = PA.MEBER_ID(+)
    andAB.BID = R.BID(+)
    andAB.SAMPLEID = PR.SAMPLEID(+)
    andAB.ABCDID = BSG.ABCDID(+)
    andAB.INFOCALLID = C.INFOCALLID(+)
    and YZ.SOMETYPEID = ''10000''
    ANDAB.INSERTTIME > SYSDATE - 35
    ANDAB.INSERTTIME < ''
    AND WX.NAME IN (''ABCD'',
    ''EFGH'',
    ''IJKL'',
    ''MNOP'',
    ''QRST'',
    ''UVWX'')
    AND MN.NAME = ''FINISHED'' '
    secondpart:_ ***ERROR PART***
    V_SAMPLEQUERY := V_SAMPLEQUERY || ' ORDER BY AB.USER'; -- Here I am getting error saving ORA-06502 - numeric or value error

    Hi,
    Wheneve you have a problem, prlease post a complete test script that people can run to re-create the problem and test their ideas. Include CREATE TABLE and INSERT statements for any tables used, abnd the results you want it to produce.
    SeshuGiri wrote:
    I am getting numeric or value error when concatenating sql script.. Are you really getting the error when you concatenate, or when you try to execute the resulting string?
    Here is the sample, I have in the stored proc.. firstpart:_ works fine if I comment the secondpart:_. (I modified the query because I am posting in the public forums)
    V_SAMPLEQUERY VARCHAR2(2000);Is that big enough? It looks like the string is right around 1000 characters; depending on your character set, that could be more than 2000 bytes. VARCHAR2s in PL/SQL can hold up to 32767 bytes.
    firstpart:_
    V_SAMPLEQUERY := '      
    SELECT
    AB.ABCDID AS ABCDID,
    CD.MEMBERID AS MEMBERID,
    CD.FNAME AS FNAME,
    CD.LNAME AS LNAME,
    CD.ACCOUNT AS ACCOUNT,
    EF.ZIP AS ZIP,
    AB.INSERTTIME AS INSERTTIME,
    AB.INSERTBY AS INSERTBY,
    ES.NAME AS STATUS,
    MYFUNCTION(E.ABCDID) AS AMOUNT,
    PA.NAME AS SOUSENAME,
    R.CODE AS BUDGETCODE,
    WX.ACCOUNTID as ACCOUNTID,
    AB.SOMETYPE AS SOMETYPE,
    AB.ACCTREP,
    ED.TYPE AS TYPE,
    AB.NOTES AS NOTES,
    GH.AREACODE || '''' || GH.PHONE_NUMBER AS PHONENUMBER,
    ED.REQUESTEDDATE,
    ED.BOOKED,
    ED.CALLERINFO
    FROM PEOPLES AB,
    LOCATIONS CD,
    LOCATIONTYPES EF,
    ACCOUNTS GH,
    ACCOUNTdetails IJ,
    ACCOUNTstatus KL,
    ACCOUNTMEMBERDETAILS MN,
    MEMBERS OP,
    BUDGET QR,
    BCODES ST,
    ACCOUNTSYSTEM UV,
    INFOCALL WX,
    PHONE_NUMBERS YZ
    WHERE AT.NAME = ''SAVINGS''
    andCD.MEMBERID = PH.MEMBERID
    andCD.MEMBERID =EF.MEMBERID
    and AT.ADDRESSTYPEID =EF.ADDRESSTYPEID
    andCD.MEMBERID =AB.MEMBERIDYou need some whitespace after the keyword "and", in the line above and also several places below.
    andAB.STATUS = ES.STATUS(+)
    andAB.ABCDID = ED.ABCDID
    andAB.ABCDID = EP.ABCDID(+)
    and EP.MEBER_ID = PA.MEBER_ID(+)
    andAB.BID = R.BID(+)
    andAB.SAMPLEID = PR.SAMPLEID(+)
    andAB.ABCDID = BSG.ABCDID(+)
    andAB.INFOCALLID = C.INFOCALLID(+)
    and YZ.SOMETYPEID = ''10000''
    ANDAB.INSERTTIME > SYSDATE - 35
    ANDAB.INSERTTIME < '' Did something get cut off here?
    AND WX.NAME IN (''ABCD'',
    ''EFGH'',
    ''IJKL'',
    ''MNOP'',
    ''QRST'',
    ''UVWX'')
    AND MN.NAME = ''FINISHED'' 'It looks like you're constructing a string for EXECUTE IMMEDIATE, but why not just use a static query?
    secondpart:_ ***ERROR PART***
    V_SAMPLEQUERY := V_SAMPLEQUERY || ' ORDER BY AB.USER'; -- Here I am getting error saving ORA-06502 - numeric or value error
    USER is the name of a built-in function, which means it's not a good name for your own column. Try user_name instead.

  • ORA-06502: PL/SQL: numeric or value error : Not able to run a script

    Hi All,
    I want to run a script like this:
    DECLARE
    I_so_status_dtl     RIB_SOStatusDtl_REC;
    BEGIN
    I_so_status_dtl := RIB_SOStatusDtl_REC('0'     --Cust Order No
                   ,'1000000014'     --Dest ID
                   ,'100010222'     --Item ID
                   ,1          --Order Line Number
                   ,1          --Unit Quantity
                   ,'R'          --Status
                   ,'RMS12DEV'     --User ID
                   ,'06-May-2001'     --Updated Date
    End;
    I am trying to run this script. Actually this script is supposed to generate an XML message, which I require. Here's the definition for the TYPE RIB_SOStatusDtl_REC:
    create or replace TYPE RIB_SOStatusDtl_REC UNDER RIB_OBJECT (
         cust_order_nbr     VARCHAR2(10),
         dest_id     VARCHAR2(10),
         item_id     VARCHAR2(25),
         order_line_nbr     NUMBER(3),
         unit_qty     NUMBER(12,4),
         status     VARCHAR2(2),
         user_id     VARCHAR2(10),
    updated_date DATE,
         overriding member procedure appendNodeValues( i_prefix in varchar2)
    ,constructor function RIB_SOStatusDtl_REC (rib_oid number, cust_order_nbr VARCHAR2, dest_id VARCHAR2, item_id VARCHAR2, order_line_nbr NUMBER, unit_qty NUMBER, status VARCHAR2) return self as result
    ,constructor function RIB_SOStatusDtl_REC (rib_oid number, cust_order_nbr VARCHAR2, dest_id VARCHAR2, item_id VARCHAR2, order_line_nbr NUMBER, unit_qty NUMBER, status VARCHAR2, user_id VARCHAR2) return self as result
    This TYPE has a body which actually generates an XML message.
    But whenever I am trying to run this, I am getting the following message:
    Error report:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at line 6
    06502. 00000 - "PL/SQL: numeric or value error%s"
    *Cause:   
    *Action:
    Therefore I am not able to run the following script. Here I am passing hard coded value within the TYPE, as I have run similar kind of scripts, which accepts this and creates an xml message. Can anyone help me what's the wrong with this script?
    Thanks & Regards,
    Debabrata

    Hi,
    Create one constructor same as with 8 parameters as you have constructor for only 7 and 8 9 parameters.
    Regards
    RK

  • ORA - 06502 NUMERIC OR VALUE ERROR

    Hi,
    When i try to compile my below code am getting NUMERIC OR VALUE ERROR.
    Here is my code :
    CREATE OR REPLACE PACKAGE SendMailJPkg AS
       -- EOL is used to separate text line in the message body
       EOL CONSTANT STRING(2) := CHR(13) || CHR(10);
       TYPE ATTACHMENTS_LIST IS TABLE OF VARCHAR2(4000);
       -- High-level interface with collections
       FUNCTION SendMail(SMTPServerName IN STRING,
                         Sender IN STRING,
                         Recipient IN STRING,
                         CcRecipient IN STRING DEFAULT '',
                         BccRecipient IN STRING DEFAULT '',
                         Subject IN STRING DEFAULT '',
                         Body IN STRING DEFAULT '',
                         ErrorMessage OUT STRING,
                         Attachments IN ATTACHMENTS_LIST DEFAULT NULL) RETURN NUMBER;
    END SendMailJPkg;
    CREATE OR REPLACE PACKAGE BODY SendMailJPkg AS
       PROCEDURE ParseAttachment(Attachments IN ATTACHMENTS_LIST,
                                 AttachmentList OUT VARCHAR2) IS
       AttachmentSeparator CONSTANT VARCHAR2(12) := '///';
       BEGIN
          -- Boolean short-circuit is used here
          IF Attachments IS NOT NULL AND Attachments.COUNT > 0 THEN
             AttachmentList := Attachments(Attachments.FIRST);
             -- Scan the collection, skip first element since it has been
             -- already processed;
             -- accommodate for sparse collections;
             FOR I IN Attachments.NEXT(Attachments.FIRST) .. Attachments.LAST LOOP
                AttachmentList := AttachmentList || AttachmentSeparator || Attachments(I);
             END LOOP;
          ELSE
             AttachmentList := '';
          END IF;
       END ParseAttachment;
       -- Forward declaration
       FUNCTION JSendMail(SMTPServerName IN STRING,
                          Sender IN STRING,
                          Recipient IN STRING,
                          CcRecipient IN STRING,
                          BccRecipient IN STRING,
                          Subject IN STRING,
                          Body IN STRING,
                          ErrorMessage OUT STRING,
                          Attachments IN STRING) RETURN NUMBER;
       -- High-level interface with collections
       FUNCTION SendMail(SMTPServerName IN STRING,
                         Sender IN STRING,
                         Recipient IN STRING,
                         CcRecipient IN STRING,
                         BccRecipient IN STRING,
                         Subject IN STRING,
                         Body IN STRING,
                         ErrorMessage OUT STRING,
                         Attachments IN ATTACHMENTS_LIST) RETURN NUMBER IS
          AttachmentList VARCHAR2(4000) := '';
          AttachmentTypeList VARCHAR2(2000) := '';
       BEGIN
          ParseAttachment(Attachments,AttachmentList);
          RETURN JSendMail(SMTPServerName,
                           Sender,
                           Recipient,
                           CcRecipient,
                           BccRecipient,
                           Subject,
                           Body,
                           ErrorMessage,
                           AttachmentList);
       END SendMail;
       -- JSendMail's body is the java function SendMail.Send()
       -- thus, no PL/SQL implementation is needed
       FUNCTION JSendMail(SMTPServerName IN STRING,
                          Sender IN STRING,
                          Recipient IN STRING,
                          CcRecipient IN STRING,
                          BccRecipient IN STRING,
                          Subject IN STRING,
                          Body IN STRING,
                          ErrorMessage OUT STRING,
                          Attachments IN STRING) RETURN NUMBER IS
       LANGUAGE JAVA
       NAME 'SendMail.Send(java.lang.String,
                           java.lang.String,
                           java.lang.String,
                           java.lang.String,
                           java.lang.String,
                           java.lang.String,
                           java.lang.String,
                           java.lang.String[],
                           java.lang.String) return int';
    END SendMailJPkg;
    var ErrorMessage VARCHAR2(4000);
    var ErrorStatus NUMBER;
    -- enable SQL*PLUS output;
    SET SERVEROUTPUT ON
    -- redirect java output into SQL*PLUS buffer;
    exec dbms_java.set_output(5000);
    BEGIN
       :ErrorStatus := SendMailJPkg.SendMail(
                    SMTPServerName => 'localhost',
                    Sender    => '[email protected]',
                    Recipient => '[email protected]',
                    CcRecipient => '',
                    BccRecipient => '',
                    Subject   => 'This is the subject line: Test JavaMail',
                    Body => 'This is the body: Hello, this is a test' ||
                             SendMailJPkg.EOL || 'that spans 2 lines',
                    ErrorMessage => :ErrorMessage,
                    Attachments  => SendMailJPkg.ATTACHMENTS_LIST(
                                       'C:\Users\Zahn\Work\sendmail.sql',
                                       'C:\Users\Zahn\Work\ferien-2002.txt'
    END;
    Can any one please suggest me how to over come this problem ???
    Regards,
    Bharath

    Raunaq wrote:
    This error generally comes , when you try to assign a non-numeric value to a numeric variable
    ORA-06502: PL/SQL: numeric or value error Occur's at various instance. The second part of the message exactly stats the reason for this error. Here are few examples.
    SQL> declare
      2    v number(2);
      3  begin
      4    v := 123;
      5  end;
      6  /
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: number precision too large
    ORA-06512: at line 4
    SQL> declare
      2    v number(2);
      3  begin
      4    v:= 'a';
      5  end;
      6  /
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at line 4
    SQL> declare
      2    v varchar2(1);
      3  begin
      4    v := 'ab';
      5  end;
      6  /
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at line 4
    SQL>

Maybe you are looking for

  • Error message occurs when I try to install Realtek HD Audio driver on Satellite M70

    Microsoft Bus Driver should be loaded in your system before installing Realtek HD Audio Driver This is the error message that I got when I tried to install the original Realtek drivers! Removed/installed the new WXP media center 2005, everything was

  • G"Green Screen" codec problem viewing podcast videos in full screen! HELP!

    I love the show "Surface" on NBC so I decided to download the first pilot episode #101 to iTunes for Windows on my computer. When I go to "full screen" mode to watch the program it goes to a "green screen" washout that is common when Quicktime is ins

  • Change name of apps

    If I try to change the name of an application in my Applications or other folders, the system prevents this but does NOT allow me to authorize the change. Even if I do a Get Info on the app, I still cannot change the name, even though I am willing to

  • User exit to change item level data in purchase order

    Hi, Can anyone let me know the user exit to change item level data in purchase order . there is a badi ME_PROCESS_PO_CUST for this but the issue is its method process_item gets triggered only when the item is changed. My requirment is For purchase or

  • Konqueror + webkit + flashblock

    Hi, while konqueror using webkit plays nice with sites that require flash, it cannot load plugins on demand. i can't get that "click to play" button to appear.  Any clues?