Error in function handlling

Hello

I have the function that should return date if you pass in values. But when you switch to invalid number, it should display an error. But my function when it is used, it does not work. Can someone help me how to handle error if pass you an invalid number.

Here's my function

create or replace function sample_date (year1 in VARCHAR2,
months1 in varchar2,
Date1 in varchar2)
RETURN VARCHAR2 AS
v_dob varchar2 (8);
Start

v_dob:=(Year1_||_to_char_(to_date_(mois1,_'LUN'), 'MM') |) Date1);

Return v_dob;
exception, then than others
then
dbms_output.put_line ('Error');
Return v_dob;
end sample_date;


When use this function like this by passing in values

Select sample_date ('9999','111 ','21 ')
Double;

It returns null instead of giving me the error invalid month. Anyone can focus on this.

Thanks in advance

Published by: user590167 on February 8, 2010 14:18

user590167 wrote:

It returns null instead of giving me the error invalid month. Anyone can focus on this.

Well, it returns the null value because you're hiding all exceptions. If you do not, it would return:

SQL> create or replace function sample_date(year1 in VARCHAR2,
  2  month1 in varchar2,
  3  date1 in varchar2)
  4  RETURN VARCHAR2 AS
  5  v_dob varchar2(8);
  6  begin
  7  v_dob:=(year1 ||to_char( to_date(month1, 'MON' ), 'MM' ) ||date1);
  8  return v_dob;
  9  end sample_date;
 10  /

Function created.

SQL> select sample_date('9999','111','21')
  2  from dual;
select sample_date('9999','111','21')
       *
ERROR at line 1:
ORA-01843: not a valid month
ORA-06512: at "SCOTT.SAMPLE_DATE", line 7

SQL> 

SY.

Tags: Database

Similar Questions

  • Error installing Fallout 3:-'Default functionality', component 'Fallout3', file: E:\data2 cab, error "incorrect function".

    Original title: 'Incorrect function' Fallout 3

    I have Vista 32-bit, all the elements for Fallout 3. It starts to install then a box pops up saying characteristic-'Default Feature', component 'Fallout3', file: E:\data2 cab, error "incorrect function".  I have the original disc, no copy, I cleaned the disc. I don't know what else to do?

    Hi tsp2u61,

    Usually, when you get this error, it means that your CD cannot be read.

    You can check if the drive works in another computer to make sure that the disk is not damaged.

    You can try to copy all the contents of the installation of the drive on the local hard drive and install from there and check if you can install

    a. right click on the desktop, create a new folder and name it as Fallout 3

    b. Insert the diskette in Fallout 3

    c. Click Start and open computer.

    d. right-click on the CD / DVD drive and click Open.

    e. press the Alt key and click on modify.

    f. click on select all.

    g. still once, press the ALT key and click on copy.

    h. Ouvrezledossier Fallout 3 on the desktop.

    i. press the Alt key and click on paste.

    Now try to install files copied on the desktop and check if it works very well.

    If this is not enough, you may need to get in touch with the help of the game maker.

    Bethesda Softworks Forums-> Fallout

    http://forums.bethsoft.com/index.php?/forum/40-fallout/

    Hope this information is useful.

    Jeremy K
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

    If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • GGetting advapi32.dll error invalid function on bootcamp

    Original title: at the start, I am reciving an error "invalid function advapi32.dll" almost all start-ups. How can I troubleshoot this to clear the error?

    Do not know what is the origin, online searches, just trying to sell me programs to erase it. some answers say hardware problems, software. all my gear works as far as I can see, no errors in the hardware Manager.

    Win xp SP3.

    Thanks in advance for any help!

    You are welcome. Marking of one (or several) of our responses as RESPONSE will officially close your thread. (No, you can't score a the answers as RESPONSE.)

  • PLSQL text validation error return function

    Hello

    I use the PLSQL text validation error return function

    that works fine

    DECLARE

    v_error varchar (1000);

    BEGIN

    IF condition = 1 THEN

    v_error: =' < span style = "color: red;" make-weight: bold; ' > You can not update dates you are not allow to update the dates </span > ';

    END IF;

    Return v_error;

    END;

    can someone tell what I can use APEX to display the v_error message in one line on the region of html

    as I use displayed element so it is wrapping the text

    Selection_004.png

    Selection_005.png

    Hi ReemaPuri,

    Change the settings for the grid of the element of error message (which is only point display) from the rest of the elements in the region so that the error message is contained in a grid and other elements are in the new grid.

    Kind regards

    Kiran

  • I have to do, if this error message appears: "JavaScript exception: error calling function selector: [object Error]? It seems that by Internet Explorer. Thank you very much for your reply and I hope you can help me.

    I have to do, if this error message appears: "JavaScript exception: error calling function selector: [object Error]? It seems that by Internet Explorer. Thank you very much for your reply and I hope you can help me.

    Hi Brad,

    Here is the link: http://projektw.primo-werbung.de/

    We have this problem only by Internet Explorer. Mozilla, Safari and Opera - there is all right.

  • I have recently installed Windows 10 free update.  Now I am unable to delete .pdf files and get the invalid error message "Function MS-DOS."  It has never been a problem with the previous Windows 8.1.  I contacted Microsoft technical support and I was tol

    I have recently installed Windows 10 free update.  Now I am unable to delete .pdf files and get the invalid error message "Function MS-DOS."  It has never been a problem with the previous Windows 8.1.  I contacted Microsoft technical support and they told me there is a problem with the .pdf application and I need to contact Adobe Acrobat. This can be corrected?

    uninstall any version of acrobat is installed.

    clean by Download Adobe Reader and Acrobat tool - Adobe Labs

    Restart your computer.

    delete all to delete pdf files.

    If this fails, it is a problem of ms.  If this attempt is successful, then reinstall your acrobat.

  • MuseSJAssert: error calling function selector: TypeError: object does not support this property or method

    I get this error message with IE, version 8 upwards. The message appears once you navigate to another page on the site and then return to the home page. Can anyone offer advice on how to solve it? As the cursor on the site doesn't seem to work with IE, we wonder if that's where the whole issue.

    The site is hosted in British Colombia and is http://www.improvementservice.org.UK

    Thanks in advance.

    Martin.

    Hi Martin,

    Could you please try some steps here.

    MuseJSAssert: Error calling function of selection: [Object Error]

  • MuseJSAssert: Error calling function selector: TypeError: $(...). toBrowserWidth is not a function

    HELP PLEASE:

    Error appearing on a website downloaded (as you view on the internet browser) as follows:

    MuseJSAssert: Error calling function selector: TypeError: $(...). toBrowserWidth is not a function

    Am new to Muse and if you can tell me what I did wrong, I would be very happy!

    Hello

    Please visit the following link http://forums.adobe.com/message/6163220#6163220

    Kind regards

    Aish

  • Error creating function.

    HII All,
    I am currently working on 10 gr 2. I'm trying to move from a column and analyze dynamically, but I met due to error. Please help me.

    Create or replace Function r_return_col
                        (
                         p_table_name          in          varchar2,
                         p_column_name          in          varchar2
                        )return varchar2
    is
    
              l_count                    number;
              l_clob                    clob;
              
              l_count_str               varchar2(32000);
              
              l_column_value          varchar2(32000);
              l_str                    clob;
              l_ret_str               clob;
    begin
              l_count_str := ' select count('||p_column_name||') ' ;
              l_count_str := l_count_str||' from      '||p_table_name ;
    
    
              execute immediate l_count_str into l_count;
              
              
              for i in 1..l_count
              loop
                   
                        
                        l_str := 'select '||p_column_name||' from ' ;
                        l_str := l_str||' ( ';
                        l_str := l_str||' select row_number() over(order by '||p_column_name||') rw,'||p_column_name||'  from '||p_table_name;
                        l_str := l_str||' ) where rw = '||i ;
              
              
                        execute immediate l_str into l_column_value;
                        
                        l_ret_str := l_column_value||','||l_column_value;
              
              
              
              end loop;
              
                   return 'select l_ret_str from dual';
              
    end;
    /
    show err;
    SQL> @D:\raghu\oracle_docs\rows_to_columns.sql
    
    Warning: Function created with compilation errors.
    
    Errors for FUNCTION R_RETURN_COL:
    
    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    34/5     PL/SQL: Statement ignored
    34/23    PLS-00382: expression is of wrong type
    Concerning
    Rambeau.

    I think the problem is the line:

    execute immediate l_str into l_column_value;
    

    run immediately makes does not work with the clob type. You must define the variable l_str as type varchar2.

    Another problem, it's your last line:

    return 'select l_ret_str from dual';
    

    You will always return the text "select l_ret_str from" dual I can't believe that's what you want. Probably you want:

    return l_ret_str;
    

    I suggest to also qualify the variable l_ret_str of type varchar2.

  • Error: No function with name to_date does exist in this scope

    Hai All

    insert into dail_att(empcode,barcode,intime,attend_date)

    (select r1.barcode, to_date (to_char (r1.bardate, 'ddmmyyyy'): min (r1.bartime), 'ddmmyyyy hh24mi'),)
    R1.bardate of the r1.barcode temp_attendance group, r1.bardat);

    It is my statement to insert

    Here I insert data Dail_att the table Temp_attendance and here R1 is the folder that I stated.

    It works very well. More I need to add a column in the Insert EMPCODE IE and I need to

    take Empl_barcode.

    Table of Empl_barcode consist of fields

    Empcode tank

    Barcode varchar

    Etc.

    So I need to include empcode in this statement when I use this in my insert statement


    insert into dail_att(empcode,barcode,intime,attend_date)
    (selecte.emplcode, r1.barcode, to_date (to_char (r1.bardate, 'ddmmyyyy'): min (r1.bartime), 'ddmmyyyy hh24mi'),)

    Temp_attendance R1.bardate, e empl_barcode, where e.barcode = r1.barcode group by

    R1. Barcode, R1.bardate, e.emplcode);


    I got an error

    No function with name to_date does exist in the scope



    Any help is highly appericatable


    Thanks and greetings

    Srikkanth.M

    Published by: Srikkanth.M on April 24, 2010 09:26

    Dear Srikkanth,
    First of all, in the table / column you provided and that the corresponding query names there are a large number of spelling errors or incompatibilities. It is very important that you make sure that your question is consistent.

    We have 'trying to figure out' if Bar_code is anme name or a table column, whence the emplcode column etc.
    Take the time to write the question and format, please.
    Frame queries and code in a pair of tags {code} without spaces.

    That said...

    update dail_att set empcode=(select emplcode
    from empl_barcode ,dail_att where bar_Code= barcode);
    
    And i have an error
    
    ORA-01427: single-row subquery returns more than one row 
    

    Let us think about this...
    The subquery in your update statement (which is the main request) is

    (select emplcode
    from empl_barcode ,dail_att where bar_Code= barcode)
    

    In this query, you want to join empl_barcode table and dail_att on * bar_code = barcode) condition.

    Why must you table dial_att in the subquery? You do not have.
    Remove dail_att the subquery table.

    VR
    Sudhakar B.

  • Microsoft Management Console error: this function is not supported on this system. Also noticed that the automatic updates did not install it and returned error 80070005.

    Original title: Microsoft Management Console this feature only is not supported on this system

    I am running Vista 32 bit Business since an administrator account.

    Recently, I noticed that the automatic updates did not install it and returned error 80070005.   After investigation, I found that I could not open mmc at all and always get the message "this function no is not supported on this system.  No major changes have been made to the configuration to trigger it and I can't watch the event log because it is in the MMC.
    I have studied this question in line and tool the following actions, which none worked:
    carried out a complete antivirus scan (I use Commodo internet security)
    created another account administrator
    has run SFC (no problem)
    has run the registry cleaner (no problem)
    has run msconfig.exe and disabled all the startup process
    updated windows right click and run as administrator
    Started in safe mode and tried all above
    After that, I don't know where to go... it doesn't seem to be a download for Windows vista to reinstall mmc.
    I have about 50 updates critical, sitting in my windows update that can not install because of this problem.  Can anyone help?
    Jeff

    Hello Helpmehelpme,

    First, I would check since it is professional Vista was that computer on a field of work or it was already on an area of work? There may be group policies that are in place that prevent to run MMC.

    When did start to happening? Is there anything new on the system which has been introduced into the environment (software, hardware)?

    This thread gives a few steps trying to the original poster that you can't have.

  • A SQL server management studio 2012 error: PERCENTILE_DISC function is not allowed in the current compatibility mode. It can only in mode 110 or higher.

    Our company just upgraded to SQL Server Management Studio 2012 and it has been very useful because I needed to use the percentile for the code I wrote. As a first step, the function did not work because I set the compatibility mode 110 level. After that I did, the function worked. However, now it does not work yet, and I get the same error:

    The PERCENTILE_DISC function is not allowed in the current compatibility mode. It can only in mode 110 or higher.

    I went to the properties of database section, then options and noticed that the compatibility mode has not changed, it is set to "SQL Server 2012 (110). I even used the following code to see if that would help at all even if the compatibility mode is already on this mode:

    ALTER DATABASE Analytics
    SET COMPATIBILITY_LEVEL = 110 
    

    Someone already had this problem or knows if I need to change something in the properties of database for this function work? Is this just a bug in the new version?

    Hello

    I suggest you post this question in the SQL Server 2012 TechNet Forums: http://social.technet.microsoft.com/Forums/en-us/category/sqlserver

    Thank you.

  • Produce pages with required checksum error: encryption function 'SH512' is not supported on this system

    Hello

    I encounter errors in an application of apex.oracle.com was exported to another environment.

    My target environment is:

    Apex 5.0.0.00.31

    Database 11.2.0.4

    Error page displays:

    The encryption function 'SH512' is not supported on this system.

    Contact your administrator for the application.

    • is_internal_error: true
    • apex_error_code: WWV_FLOW_CRYPTO. UNSUPPORTED_FUNCTION
    • Component.type: APEX_APPLICATION_BUTTONS
    • Component.ID: 8787606655825740717
    • Component.Name: COPY
    • error_backtrace: - PL/SQL call stack - line object handle number name of the object 0x1d785dc58 641

    package APEX_050000.WWV_FLOW_ERROR 709 0x1d785dc58 body

    package APEX_050000.WWV_FLOW_ERROR 0x1d785dc58 1013 body

    package APEX_050000.WWV_FLOW_ERROR 0x1cde954b0 328 bodies

    package APEX_050000.WWV_FLOW_CRYPTO 0x1ddf7b498 1506 body

    package APEX_050000.WWV_FLOW_SECURITY 0x16f574d40 9657 body

    package APEX_050000.WWV_FLOW_UTILITIES 0x1d7fa7ed8 370 body

    package APEX_050000.WWV_FLOW_BUTTON 0x1ed9fe680 2288 body

    package APEX_050000.WWV_FLOW 0x1ed9fe680 2351 body

    package APEX_050000.WWV_FLOW 0x1d71535d8 1720 body

    package APEX_050000.WWV_FLOW_DISP_PAGE_PLUGS 0x1d71535d8 972 body

    package APEX_050000.WWV_FLOW_DISP_PAGE_PLUGS 0x17bf9b618 2221 body

    package APEX_050000.WWV_FLOW_PAGE 0x17bf9b618 2447 body

    package APEX_050000.WWV_FLOW_PAGE 0x1ed9fe680 4938 body

    package APEX_050000.WWV_FLOW 0x1d79de248 173 body

    procedure APEX_050000.F 0x1d77eeb10 33 anonymous block

    This seems to be related to the buttons on the page that redirects to pages that have the value Arguments Page Access Protection must have Checksum.  If I hide buttons, or change the page on the target pages access protection Unrestricted page works fine.

    Bug in Apex 5?

    Hi 1043414,

    APEX 5 works on 12 c, where SH512 is supported. Default APEX uses the most secure algorithm on the platform where you develop. If you need to copy the app to 11g, please make sure that the checksum algorithm is supported on this platform. Go for the shared components > security attributes and click the Bookmarks button expire, where you can change the algorithm.

    Kind regards

    Christian

  • MuseJSAssert: Error calling function selector: TypeError: one is not defined

    An error occurs when an external script "MuseJSAssert: error by calling the selection function: TypeError: one is not defined" I use the Firefox browser. Help, please!

    Hello

    Try the suggestion given here Re: MuseJSAssert: error calling the function switch: TypeError: 'undefined' is not a function (assessment ' )

  • error in functions

    I connect to oracle via R with success, but it has error when I run functions. These are the functions

    Ore.Connect (conn_string = "ore_wallet", all = TRUE)
    Error in .oci. Connect (...):
    ORA-12154: TNS: could not resolve the connect identifier specified

    or as a regression or...

    but the ore.connection function is executed successfully.
    What should I do?

    Based on the error message you posted ore.connect not a not so you won't be able to use all functions of ore. Do you need to use Oracle Wallet in this context? If this is not the case, first try something simpler. If you can connect to a database with sqlplus user/pass@db then ore.connect (user = "user", password = "pass", conn_string = "db") should also work. If the DB is run locally you can use conn_string = "' (in this case sqlplus user/pass should work as well).

Maybe you are looking for