Function with incomplete parameters

I create a function with many parameters
and I call this function through my application
but when I call function I must declare all parameter inside this function like
ddd("a","b",0,0,0,0,0,0,0)
is there a method let function set a default value for parameter if code didn't declare it

You can send just few first parameters and the rest will be passed as false. If you need to pass, say, first and 7th parameter, then you put 6 commas between values, as there is no named parameters in VFP and all parameters are passed by position.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles

Similar Messages

  • Question about function with in parameters

    Hello,
    I have a question about functions with in-parameters. In the HR schema, I need to get the minimum salary of the job_id that is mentioned as an in-parameter.
    this is what I am thinking but I dont know if it's correct or not or what should I do next!
    create or replace function get_minimum_salary (i_job_id in varchar2)
    return number
    as
    begin
    SELECT min_salary INTO min_sal
    FROM jobs
    where job_id = get_minimum_salary(xy);
    RETURN i_job_id;
    end get_minimum_salary;
    thanks in advance
    EDIT
    Thanks for your help all.
    Is it possible to add that if the i_job_id which is the in type parameter does not have a minimum salary then use the following function to register an error:
    create or replace procedure insert_error (i_error_code in number,
                                                      i_error_message in varchar2)
    as
    begin
    insert into error_table (error_user, error_date, error_code, error_message)
    values (user,sysdate,i_error_code,i_error_message);
    end insert_error;
    This function is basically to say that an error has occured and to register that error, at the same time I need to print out the error using the dbms_out.put_line.
    Any ideas of how to do that?
    Thanks again
    Edited by: Latvian83 on Jun 1, 2011 5:14 AM

    HI
    I have made little bit changes in ur code. try this
    create or replace function get_minimum_salary (i_job_id in varchar2)
    return number
    as
    v_Min_sal jobs.salary%type=0;---- Variable declaration
    begin
    SELECT min_salary INTO v_ min_sal
    FROM jobs
    where job_id = i_job_id;
    RETURN v_Min_sal;
    end get_minimum_salary;
    Regards
    Srikkanth.M

  • Curve fitting problem: simultaneously fitting two datasets to two different model functions with shared parameters

    Hello! As stated above, I have the following problem: I have 2 sets (different systems) of measurement data (Voltages measured as functions of applied frequency). I would like to make curve fits with Levenber-Marquardt-method to both datasets (the datasets have the same x-values = frequencies), fitting the 2 datasets to their own separate model functions. However, the different model functions should have same values for the shared parameters (this prevents me from doing 2 totally separate curve fittings).
    I have LabVIEW version 7.1, if anybody could help me with the problem, I would appreciate it very much. Thank you!

    Would you like to try this:
    http://forums.ni.com/t5/LabVIEW/levenberg-Marquardt/td-p/668782
    http://zone.ni.com/reference/en-XX/help/371361G-01/gmath/nonlinear_curve_fit/
    http://digital.ni.com/public.nsf/allkb/BACF6FDF1B40993686256CC300657BA4
    With LV 7.1, I don't know if we have a such feature with that version. Please check out for the latest LV versions.
    BR,
    Make Nguyen
    NI Finland Technical Support

  • Oracle Function with out parameters

    Hi, I'm trying to access a stored function on an oracle server with 2 out parameters, 2 in parameters and an out ref cursor.
    PL/SQL looks like this
    nStatusCode OUT INTEGER,
    sStatusMsg OUT VARCHAR2,
    sUsrNr           IN VARCHAR2,
    sPassword           IN VARCHAR2,
    crsReturn OUT pck_cursor.retRecordSet
    I drag the function onto dataset designer and it successfully maps the results to the datatable, it maps datatypes for first out parameters to decimal and string.
    the method genearated for fill by looks like (out decimal?,out string,string, string, out object)
    problem is, everytime i try to call this function it gives me casting exceptions for the first 2 out parameters, for the decimal it's not specified in more detail. for the other one it says there was an exception casting from OracleString to string. If I change the PL/SQL function to leave the first 2 out parameters away it works fine. Do I manually need to change the TableAdapter definitions??

    Hi,
    I think I found the problem but not a good solution. It seems to be a problem with auto code generation for TableAdapters in the Dataset wizard. In the Parameter Definition for the Command I set DbType.Decimal and DbType.Sting for the SqlDbtype Property of the out params. The GetData and Fill Method is generated with Fill(out decimal? out1, out string out2). When I look in the generated code ith first sets the SqlDbtype as written but after this also the OracleDbtype to OracleDbType.Decimal and OracleDbType.Varchar2. The casting these types before returning the throws the exception. Any idea how to change this behavior?

  • Select from function with named parameters doesn't work

    Hello,
    I'm trying to execute the next sql statement:
    SELECT mypack.getvalue(user_id => 231, status => 'closed') AS someAlias FROM DUAL;
    I'm getting the next Error:
    Error: ORA-00907: missing right parenthesis
    But the next works fine:
    SELECT mypack.getvalue(231,'closed') AS someAlias FROM DUAL;
    What I'm doing wrong?
    Is there a way to call a Function and return it's result as a single-row query?
    Thanks for any suggestions.

    Thanks for your answers.
    Just want to explain what I want to accomplish:
    I want to create PL/SQL statement which:
    1) Calls Function in named notation way;
    2) Returns a query which contains a single row - a Function result.
    I know in Transact-SQL I can accomplish this the next way:
    DECLARE @return_value INT
    EXEC[myproc]
    @id=2,
    @status='ok',
    @ret_param=@return_value OUTPUT
    SELECT @return_value AS my_return_value
    The last SELECT call returns a query with one row in it.
    How can I do the same in Oracle?
    Thanks a lot!

  • Java function with oracle parameters

    Hi all,
    Does someone knows why i have an error using the java function setDouble with the NLS_TERRITORY = FRANCE and not with NLS_TERRITORY = AMERICA ?
    what have i do to correct it ?
    Thanks in advance

    What is the output of the following, both when
    NLS_TERRITORY = FRANCE and with NLS_TERRITORY = AMERICA ?
    SQL> select to_number('123.45') from dual ;
    TO_NUMBER('123.45')
                 123.45
    1 row selected.
    SQL> select to_number('123,45') from dual ;
    select to_number('123,45') from dual
    ERROR at line 1:
    ORA-01722: invalid number
    SQL>

  • Custom sequences or functions with default parameters

    Hello!
    Using the Stimulus Profile Editor, I am finding that using a sequence within a sequence to be cumbersome.  This is because it requires you to declare in the main sequence, every parameter that the sub-sequence will use.
    I would like to have a 'configure' sequence whose parameters are all default and do not need to be declared or passed through by every sequence that calls it. Right now, if I change one argument of the 'configure' sequence I have to go to every sequence that references it, and update the parameters and the sequence call.
    Essentially, I would just like an independent  subfuction that has no inputs and returns a few outputs. If the profile editor is not capable of this, what would be my next best option?
    Thanks!

    Hello,
    You can take advantage of the new features in NIVS 2014 to help against re-defining default values for your RT Sequences. Take a look at the documentation in 2014 which explains in more detail how you can use channel references in your sequences:
    What's New in NI VeriStand 2014
    http://zone.ni.com/reference/en-XX/help/372846H-01/veristand/whats_new/
    Variables for Reading and Writing Channels in a Real-Time Sequence
    http://zone.ni.com/reference/en-XX/help/372846H-01/veristand/spe_vars_chref_parameters/
    Example 1a: Reading and Writing Channels Directly from a Real-Time Sequence
    http://zone.ni.com/reference/en-XX/help/372846H-01/veristand/spe_tutorial_example1a/
    By using channel references, you won't have to re-set default parameters. Let me know if you have any questions. 
    Sincerely,
    Aldo A
    Applications Engineer
    National Instruments

  • Invoking of functions with number parameters

    Oracle 9i PL/SQL dictates that
    if the constraints of the formal parameter do not suffice actual parameter constraints,runtime error is raised.
    I tried the following code snippet to check this out.
    test_returntype7 returns a floationg point literal
    test_returntype8 returns a floationg point number
    SQL> create or replace function test_returntype7
    2 return number
    3 as
    4 begin
    5 null;
    6 return 21.345;
    7 end test_returntype7;
    8
    9 /
    Function created.
    SQL> declare
    2 v_output number(1);
    3 begin
    4 v_output := test_returntype7;
    5 dbms_output.put_line(v_output);
    6 end;
    7 /
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: number precision too large
    ORA-06512: at line 4
    --This is fine
    SQL> declare
    2 v_output number(2);
    3 begin
    4 v_output := test_returntype7;
    5 dbms_output.put_line(v_output);
    6 end;
    7 /
    --This is fine
    21
    PL/SQL procedure successfully completed.
    --This is fine
    SQL> declare
    2 v_output number(3);
    3 begin
    4 v_output := test_returntype7;
    5 dbms_output.put_line(v_output);
    6 end;
    7 /
    21
    --This is fine
    PL/SQL procedure successfully completed.
    SQL> declare
    2 v_output number(2,3);
    3 begin
    4 v_output := test_returntype7;
    5 dbms_output.put_line(v_output);
    6 end;
    7 /
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: number precision too large
    ORA-06512: at line 4
    --Why is this not working
    SQL> declare
    2 v_output number(2,10);
    3 begin
    4 v_output := test_returntype7;
    5 dbms_output.put_line(v_output);
    6 end;
    7 /
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: number precision too large
    ORA-06512: at line 4
    --Why is this not working
    SQL> create or replace function test_returntype8
    2 return number
    3 as
    4 v_num number(2,3);
    5 begin
    6 v_num := 21.345;
    7 return v_num;
    8 end test_returntype8;
    9 /
    Function created.
    SQL> declare
    2 v_output number(2);
    3 begin
    4 v_output := test_returntype8;
    5 dbms_output.put_line(v_output);
    6 end;
    7
    8 /
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: number precision too large
    ORA-06512: at "CERT.TEST_RETURNTYPE8", line 6
    ORA-06512: at line 4
    --Why is this not working
    SQL>
    SQL> declare
    2 v_output number(2,3);
    3 begin
    4 v_output := test_returntype8;
    5 dbms_output.put_line(v_output);
    6 end;
    7
    8 /
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: number precision too large
    ORA-06512: at "CERT.TEST_RETURNTYPE8", line 6
    ORA-06512: at line 4
    --Why is this not working
    SQL> declare
    2 v_output number(3);
    3 begin
    4 v_output := test_returntype8;
    5 dbms_output.put_line(v_output);
    6 end;
    7 /
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: number precision too large
    ORA-06512: at "CERT.TEST_RETURNTYPE8", line 6
    ORA-06512: at line 4
    --Why is this not working
    Could any body clarify the behaviour of code snippets
    Thanks in advance
    Ann.

    KK,
    I tried the following
    SQL> declare
    2 v_output number(4,2);
    3 begin
    4 v_output := test_returntype7;
    5 dbms_output.put_line(v_output);
    6 end;
    7 /
    PL/SQL procedure successfully completed.
    This is fine.
    SQL> declare
    2 v_output number(4,2);
    3 begin
    4 v_output := test_returntype8;
    5 dbms_output.put_line(v_output);
    6 end;
    7 /
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: number precision too large
    ORA-06512: at "CERT.TEST_RETURNTYPE8", line 6
    ORA-06512: at line 4
    Why is this not working
    What do you mean by precision should be a part of scale?
    I tried this also
    SQL> declare
    2 v_output number(5,3);
    3 begin
    4 v_output := test_returntype8;
    5 dbms_output.put_line(v_output);
    6 end;
    7 /
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: number precision too large
    ORA-06512: at "CERT.TEST_RETURNTYPE8", line 6
    Thanks,
    Ann.

  • Complicated PL/SQL questions that involves function with in type parameter

    Hello,
    I have a question about functions with in-parameters. In the HR schema, I need to get the minimum salary of the job_id that is mentioned as an in-parameter.
    this is what I am thinking but I dont know if it's correct or not or what should I do next!
    create or replace function get_min_salary (i_job_id in varchar2)
    return number
    as
    min_sal jobs.min_salary%type;
    begin
    SELECT min_salary INTO min_sal
    FROM jobs
    where job_id = i_job_id;
    RETURN min_sal;
    end get_min_salary;if the i_job_id which is the in type parameter does not have a minimum salary then use the following function to register an error:
    create or replace procedure insert_error (i_error_code in number,
    i_error_message in varchar2)
    as
    begin
    insert into error_table (error_user, error_date, error_code, error_message)
    values (user,sysdate,i_error_code,i_error_message);
    end insert_error;This function is basically to say that an error has occured and to register that error, at the same time I need to print out the error using the dbms_out.put_line.
    Any ideas of how to do that?
    Thanks in advance

    >
    minimum salary of the job_id
    >
    may be
    SELECT min(min_salary) INTO min_sal
    FROM jobs
    where job_id = i_job_id;
    if the i_job_id which is the in type parameter does not have a minimum salary then use the following function to register an error:why error?
    This function is basically to say that an error has occured and to register that error, at the same time I need to print out the error using the dbms_out.put_line.
    create or replace procedure insert_error (i_error_code in number,
    i_error_message in varchar2)
    as
    begin
    insert into error_table (error_user, error_date, error_code, error_message)
    values (user,sysdate,i_error_code,i_error_message);
    -- this
    dbms_out.put_line('this');
    end insert_error;

  • AddEventListener and Function with Parameters

    Hello guys
    I got this situation
    nameTxt.addEventListener(FocusEvent.FOCUS_IN,formTextHandler);
             private function formTextHandler(text:String):void{
    where i want to send some additional information too
    so how could i do that?
    Thanks

    hi,
       it seems like you will need to extend your text Component and Event class as well. Its not clear from your code that what component you are referring to . so generally you will extend your required component .
    you will need to addEvent Listener
    FocusEvent.FOCUS_IN
    in your custom extended component and in the handler of that focusEvent you will dispatch your new custom event with the parameters from this FocusEvent you received and as well as new parameters that are also required by your new extended Event.
    Method of extending events is straight forward. e.g this a sample for extending Events you will need to modify it with the paramaters you require in your event .
    package
        import flash.events.Event;
        public class AccountEvent extends Event
            public var accountObj:Object
            public static var NewAccount:String='newAccount'
            public function AccountEvent(type:String,newAccount:Object)
                super(type)
                this.accountObj=newAccount
    and here is the code how to use this event
    package
        import flash.events.Event;
        import flash.events.FocusEvent;
        import AccountEvent
        import mx.controls.TextInput
        public class customText extends TextInput
            public function customText()
                super();
                addEventListener(FocusEvent.FOCUS_IN,onFocus)
            private function onFocus(e:FocusEvent):void{
                dispatchEvent(new AccountEvent(paramaters.....///here you will add your custom paramerters and 
               //you will catch this event in your main application rather then catching the focus in event

  • Crystal Reports from R/3 function with parameters

    I can create reports from functions that doesn't require parameters, but for one function, the R/3 admin created the function that needs parameters (start and end date) to return records in that range. Does anyone know how to supply the parameter? I tried to select records by start and end date, but didn't work.
    thanks
    Jenny

    Hi Ingo:
       Thank you for replying. It seems I have created the report correctly, but the function is not properly configured. So I'm forwarding the issue back to our R/3 admin.
    Jenny
    Edited by: Jenny Gu on Dec 22, 2011 3:10 AM

  • Calling a Stored Procedure with output parameters from Query Templates

    This is same problem which Shalaka Khandekar logged earlier. This new thread gives the complete description about our problem. Please go through this problem and suggest us a feasible solution.
    We encountered a problem while calling a stored procedure from MII Query Template as follows-
    1. Stored Procedure is defined in a package. Procedure takes the below inputs and outputs.
    a) Input1 - CLOB
    b) Input2 - CLOB
    c) Input3 - CLOB
    d) Output1 - CLOB
    e) Output2 - CLOB
    f) Output3 - Varchar2
    2. There are two ways to get the output back.
    a) Using a Stored Procedure by declaring necessary OUT parameters.
    b) Using a Function which returns a single value.
    3. Consider we are using method 2-a. To call a Stored Procedure with OUT parameters from the Query Template we need to declare variables of
    corresponding types and pass them to the Stored Procedure along with the necessary input parameters.
    4. This method is not a solution to get output because we cannot declare variables of some type(CLOB, Varchar2) in Query Template.
    5. Even though we are successful (step 4) in declaring the OUT variables in Query Template and passed it successfully to the procedure, but our procedure contains outputs which are of type CLOB. It means we are going to get data which is more than VARCHAR2 length which query template cannot return(Limit is 32767
    characters)
    6. So the method 2-a is ruled out.
    7. Now consider method 2-b. Function returns only one value, but we have 3 different OUT values. Assume that we have appended them using a separator. This value is going to be more than 32767 characters which is again a problem with the query template(refer to point 5). So option 2-b is also ruled out.
    Apart from above mentioned methods there is a work around. It is to create a temporary table in the database with above 3 OUT parameters along with a session specific column. We insert the output which we got from the procedure to the temporary table and use it further. As soon the usage of the data is completed we delete the current session specific data. So indirectly we call the table as a Session Table. This solution increases unnecessary load on the database.
    Thanks in Advance.
    Rajesh

    Rajesh,
    please check if this following proposal could serve you.
    Define the Query with mode FixedQueryWithOutput. In the package define a ref cursor as IN OUT parameter. To get your 3 values back, open the cursor in your procedure like "Select val1, val2, val3 from dual". Then the values should get into your query.
    Here is an example how this could be defined.
    Package:
    type return_cur IS ref CURSOR;
    Procedure:
    PROCEDURE myProc(myReturnCur IN OUT return_cur) ...
    OPEN myReturnCur FOR SELECT val1, val2, val3  FROM dual;
    Query:
    DECLARE
      MYRETURNCUR myPackage.return_cur;
    BEGIN
      myPackage.myProc(
        MYRETURNCUR => ?
    END;
    Good luck.
    Michael

  • ORA-06521: PL/SQL: Error mapping function with 10.1.0 external procedure

    We have an external procedure running fine on 8.1.7 on VMS. After compiling and linking succesfully under 10.1.0, I get ORA-06521 PL/SQL: Error mapping function and ORA-06522: ERROR - vms_dlsym for file x, where x in the filename of the linked executable. Another external procedure that does not connect to the 10.1.0 database runs fine. What could be causing this error in Server 10.1.0 on VMS?
    Thanks,
    Dave

    Here is the code to create the function:
    CREATE OR REPLACE FUNCTION f1
    (h_file_name IN VARCHAR2)
    RETURN BINARY_INTEGER
    IS EXTERNAL
    LIBRARY l1
    NAME "f1"
    LANGUAGE C
    WITH CONTEXT
    PARAMETERS
    (CONTEST,
    h_file_name string);
    Here is the beginning of the Pro*C:
    int f1(epctx, h_file_name)
    OCIExtProcContext *epctx;
    char h_file_name[70];
    char h_line_txt [251];
    int lineno;
    FILE *fptr;
    /* register the connection context ... */
    EXEC SQL REGISTER CONNECT USING :epctx;
    The function loads a flat file into the database. It is probably not related but are unable to SQLPLUS/ or SQLLDR/ into the database from an OS autheniticated account (get ORA-12547: TNS:lost contact.) Thanks for taking the time to look at this. There aren't many people trying this on VMS, I'd bet.

  • How to use Count with Date Parameters

    Hello,
    I am having issues using the Count() function in conjunction with date parameters.
    This is a Siebel report and in my report I have 2 date parameters(From Date, To Date). In a nutshell I am basically trying to count Opportunities that has a start date within the given date period. However I don't see a reasonable way to put my date parameters within the Count() function. The reason being is that I need to have a huge chunk of code to convert the dates into a common format that can be compared, and it won't even fit within the code block in my rtf template. I am not even sure how to put multiple conditional statements inside a Count() function since all the examples I have seen are very simple.
    Anyone have a suggestion on how to use Count() with date parameters?
    Thanks.

    Any chance you can get the date formats in the correct format from siebel?
    I don't know Siebel - so I can't help you with that. If you get the correct format it is just
    <?count(row[(FromDate>=date) and  (date<=ToDate))?>
    Otherwise the approach would probably need to use string function to get year/monthd/day from the date
    and store it into a varialbe and compare later the same way
    <?variable@incontext:from; ....?>
    <?variable@incontext:to; ...?>
    <?count(row[($from>=date) and  (date<=$to))?>
    Potentially you can use the date functions such as xdofx:to_date to do the conversion
    [http://download.oracle.com/docs/cd/E12844_01/doc/bip.1013/e12187/T421739T481158.htm]
    But I am not sure if they are available in your siebel implementation.
    Hope that helps

  • How to call stored procedure with multiple parameters in an HTML expression

    Hi, Guys:
    Can you show me an example to call stored procedure with multiple parameters in an HTML expression? I need to rewrite a procedure to display multiple pictures of one person stored in database by clicking button.
    The orginal HTML expression is :
    <img src="#OWNER#.dl_sor_image?p_offender_id=#OFFENDER_ID#" width="75" height="75">which calls a procedure as:
    procedure dl_sor_image (p_offender_id IN NUMBER)now I rewrite it as:
    PROCEDURE Sor_Display_Current_Image(p_n_Offender_id IN NUMBER, p_n_image_Count in number)could anyone tell me the format for the html expression to pass multiple parameters?
    Thanks a lot.
    Sam

    Hi:
    Thanks for your help! Your question is what I am trying hard now. Current procedure can only display one picture per person, however, I am supposed to write a new procedure which displays multiple pictures for one person. When user click a button on report, APEX should call this procedure and returns next picture of the same person. The table is SOR_image. However, I rewrite the HTML expression as follows to test to display the second image.
    <img src="#OWNER#.Sor_Display_Current_Image?p_n_Offender_id=#OFFENDER_ID#&p_n_image_Count=2" width="75" height="75"> The procedure code is complied OK as follows:
    create or replace
    PROCEDURE Sor_Display_Current_Image(p_n_Offender_id IN NUMBER, p_n_image_Count in number) AS
        v_mime_type VARCHAR2(48);
        v_length NUMBER;
        v_name VARCHAR2(2000);
        v_image BLOB;
        v_counter number:=0;
        cursor cur_All_Images_of_Offender is
          SELECT 'IMAGE/JPEG' mime_type, dbms_lob.getlength(image) as image_length, image
          FROM sor_image
          WHERE offender_id = p_n_Offender_id;
        rec_Image_of_Offender cur_All_Images_of_Offender%ROWTYPE;
    BEGIN
        open cur_All_Images_of_Offender;
        loop
          fetch cur_All_Images_of_Offender into rec_Image_of_Offender;
          v_counter:=v_counter+1;
          if (v_counter=p_n_image_Count) then
            owa_util.mime_header(nvl(rec_Image_of_Offender.mime_type, 'application/octet'), FALSE);
            htp.p('Content-length: '||rec_Image_of_Offender.image_length);
            owa_util.http_header_close;
            wpg_docload.download_file (rec_Image_of_Offender.image);
          end if;
          exit when ((cur_All_Images_of_Offender%NOTFOUND) or (v_counter>=p_n_image_Count));
        end loop;
        close cur_All_Images_of_Offender;
    END Sor_Display_Current_Image; The procedure just open a cursor to fetch the images belong to the same person, and use wpg_docload.download_file function to display the image specified. But it never works. It is strange because even I use exactly same code as before but change procedure name, Oracle APEX cannot display an image. Is this due to anything such as make file configuration in APEX?
    Thanks
    Sam

Maybe you are looking for