How to use Default parameters

Hello,
How do I use default parameters from ODP.NET. I have a proc in Oracle that shows Default? = Y when I do Describe in PL/SQL Developer. Therefore, I don't want to pass this parameter at all via ODP.NET/C# call. If I omit this parameter, I get the dreaded "Invalid number or types of parameters" error.
Thanks for your help,
Evgueni

Hi,
You'll just want to set OracleCommand::BindByName=true. Here's an example, hope it helps.
Greg
create or replace function showparams(p1 varchar2, p2 varchar2 default 'foo',
           p3 varchar2, p4 varchar2 default 'bar') return varchar2
is
retval varchar2(4000);
begin
retval := 'p1 = '|| p1;
retval := retval || ',p2 = ' || p2;
retval := retval || ',p3 = ' || p3;
retval := retval || ',p4 = ' || p4;
return retval;
end;
using System;
using System.Data;
using Oracle.DataAccess.Client;
class testdefault
    static void Main(string[] args)
        using (OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger"))
            con.Open();
            using (OracleCommand cmd = new OracleCommand("showparams", con))
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.BindByName = true;
                cmd.Parameters.Add( new OracleParameter("retval", OracleDbType.Varchar2,4000));
                cmd.Parameters["retval"].Direction = ParameterDirection.ReturnValue;
                cmd.Parameters.Add("p1", "firstval");
                cmd.Parameters.Add("p3", "secondval");
                cmd.ExecuteNonQuery();
                Console.WriteLine(cmd.Parameters["retval"].Value.ToString());
}OUTPUT
=========
p1 = firstval,p2 = foo,p3 = secondval,p4 = bar
Press any key to continue . . .

Similar Messages

  • How does works default parameters in a program with logical database PNP?

    Hi Friends,
      I have a basic program, i need to filter info with period parameters in a program that uses logical database PNP, but it doesn't work.
      If i use "person selection period" that it's suposed to filter info according to infotype 0001 (as the sap help says), it doesn't work, i use: PNPBEGPS = today and PNPENDPS = today, and the result it's a lot of registers that doesn't meet that criteria.
      Also i tried with: data selection period, today, up to day, current month. And the result it's with the same problem.
      How does works period parameters in a program with logical database PNP?
    This it's the program example, i use the default category.
    REPORT  ZRPHRTEST.
    tables: pernr.
    infotypes: 0001.
    start-of-selection.
    get pernr.
      write: pernr-pernr, p0001-begda, p0001-endda.
    end-of-selection.
    write 'fin'.

    Hi,
    Define pernr table under tables statement then and use GET PERNR event.This get event is followed by End-Of-Selection.
    Syntax: Tables pernr.
                Get pernr.
    Try, activate and test. This should solve your problem.
    Regards,
    Abhijeet

  • How to use Default value in a column in Tabular form in insertion or upda

    Hello,
    I am trying to use Default values so that user need not have to enter data, but when I select default type and put a default value, I see an error message, if I try to add a new row.
    How can I use a default value in a Column in a Tabular Form?
    Gouri
    Edited by: user1046395 on Apr 3, 2009 9:58 AM

    Gouri,
    You can just simply edit to each column's report attribute. For example,
    To set default date,
    Default Type: PL/SQL Expression of Function
    Default: sysdate
    To set default text,
    Default Type: PL/SQL Expression of Function
    Default: *'CLERK'*
    If you still have an error, what is the error message?
    Ittichai

  • How to use HTML parameters in Java applet

    Hello
    In perl I have created a form with things like a selectiuon box called currency and text fields called product for example. Then when I click submit the perl program can pick up the currency and product parameters.
    I have read about applet param eg <param name="param1" value="Apple"> is this the same thing? Or is it different?
    Can I use HTML parameters or do I need to use applet param? I am confused.
    If applet param is what I need, then how do I change the param values say by editing text in a text field?

    You will need to use Java Native Interface JNI. Ther are many posts on the subject, please search, and this is the documentation:
    http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/jniTOC.html

  • When & how to use default settings option in job scheduling with BO 4.1

    Hi,
    With BO 4.1 we got new features and one of them is "Default Settings" option in the job scheduling. While scheduling a report in CMC we are getting below attached screen. I want to know when and how to use this option? while scheduling job on queries.
    Please guide me to, thanks in advance.
    Regards,
    Mithun Pati.

    Hi Mithun,
    Below thread may give you clear idea.
    The Purpose of the default settings is to have customized default settings for the enterprise. These settings would apply to any user who has access to Info view and wants to schedule a report. For example you can setup default values for "From" section of email so any scheduled reports use those settings. Similarly another setting we have defaulted is the number of retires involved and the seconds for each retry. Business Objects will not send out a failure emails unless the last retry has failed. The default settings should only be modified by an admin.
    Purpose of Default Settings when scheduling a WebI report?

  • Compiling Error when using Default Parameters

    Hi
    I tried to compile some sources within a Development Environment of a CAD-System (CATIA V5). The compiler Version 4.2 is required. But only 5.3 (Forte C++ WS6U2) is available. So I compiled with option -compat (or -compat=4).
    The compiler stops at this line
    typedef CATBoolean (CATCommand::*ActionMethod)(void * iData = NULL) ;
    with the following Error
    "/usr/lpp/cat500/B07/./DialogEngine/ProtectedInterfaces/CATDiaAction.h", line 30:
    Error: Default parameters are not allowed for unsigned char(void*)
    When I modify the line to
    typedef CATBoolean (CATCommand::*ActionMethod)(void * iData) ;
    everything works fine. But the Problem is, that the modified Header File is part of the delivered Development Environment. Normally I should not modify such a file
    Compiler Call + Options:
    CC -c -DUNIX -DSunOS \
    -compat=4 library=rwtools7,iostream \
    -noex -xO2 -w -mt -xarch=v8 -xchip=ultra -KPIC \
    -D_LANGUAGE_CPLUSPLUS \
    -D_SUNOS_SOURCE -D_ENDIAN_BIG -DOS_SunOS \
    -D_MK_CONTNAME_=PSOLUserIntegrationPartApi \
    -D_MK_MODNAME_=PSOLUserIntegrationPartApi -D_MK_FWNAME_=External \
    -I/home/src/LocalInterfaces \
    -I/home/src/LocalGenerated/solaris_a \
    -I/home/src/ProtectedInterfaces \
    -I/home/src/ImportedInterfaces/solaris_a \
    -I/usr/dt/include \
    -I/usr/openwin/include \
    /home/src/PSOLUserIntegrationGeometryCmd.cpp ) \
    Any idea which compiler option I could use to avoid the Error I explained before ?
    Here some more Infos:
    Solaris7
    CC: Sun WorkShop 6 update 2 C++ 5.3 2001/05/15
    Thanks in Advance

    Hi
    I tried to compile some sources within a Development Environment of a CAD-System (CATIA V5). The compiler Version 4.2 is required. But only 5.3 (Forte C++ WS6U2) is available. So I compiled with option -compat (or -compat=4).
    The compiler stops at this line
    typedef CATBoolean (CATCommand::*ActionMethod)(void * iData = NULL) ;
    with the following Error
    "/usr/lpp/cat500/B07/./DialogEngine/ProtectedInterfaces/CATDiaAction.h", line 30:
    Error: Default parameters are not allowed for unsigned char(void*)
    When I modify the line to
    typedef CATBoolean (CATCommand::*ActionMethod)(void * iData) ;
    everything works fine. But the Problem is, that the modified Header File is part of the delivered Development Environment. Normally I should not modify such a file
    Compiler Call + Options:
    CC -c -DUNIX -DSunOS \
    -compat=4 library=rwtools7,iostream \
    -noex -xO2 -w -mt -xarch=v8 -xchip=ultra -KPIC \
    -D_LANGUAGE_CPLUSPLUS \
    -D_SUNOS_SOURCE -D_ENDIAN_BIG -DOS_SunOS \
    -D_MK_CONTNAME_=PSOLUserIntegrationPartApi \
    -D_MK_MODNAME_=PSOLUserIntegrationPartApi -D_MK_FWNAME_=External \
    -I/home/src/LocalInterfaces \
    -I/home/src/LocalGenerated/solaris_a \
    -I/home/src/ProtectedInterfaces \
    -I/home/src/ImportedInterfaces/solaris_a \
    -I/usr/dt/include \
    -I/usr/openwin/include \
    /home/src/PSOLUserIntegrationGeometryCmd.cpp ) \
    Any idea which compiler option I could use to avoid the Error I explained before ?
    Here some more Infos:
    Solaris7
    CC: Sun WorkShop 6 update 2 C++ 5.3 2001/05/15
    Thanks in Advance

  • How to use event parameters?

    Hi
    I've made simple eem applet for shutdown the port which trigered storm control event.
    It is look like that:
    event manager applet shut-storm
      event storm-control
      action 1.0 cli local python bootflash:shut-storm.py
    and the script is
    from cisco import CLI
    from cisco import cli
    import sys
    import datetime
    import time
    import re
    whitelist = [
    "Ethernet1/1",
    "Ethernet1/2"]
    shlog = CLI('sh logg last 100 | i ETHPORT-5-STORM_CONTROL_ABOVE_THRESHOLD | last 3',False).get_output()
    pat = re.compile(r'(\d{4} \w{3} \d{2} \d\d:\d\d:\d\d) \S+ \%ETHPORT-5-STORM_CONTROL_ABOVE_THRESHOLD: Traffic in port (Eth\S+|[Pp]o\S+)')
    now = datetime.datetime.now()
    delta = datetime.timedelta(seconds=180)
    for l in shlog:
      mobj = pat.match(l)
      if mobj:
        port       = mobj.group(2)
        logTimeStr = mobj.group(1)
        logTimeObj = time.strptime(logTimeStr, "%Y %b %d %H:%M:%S")
        logTime    = datetime.datetime(*logTimeObj[:6])
        if now-logTime < delta:
          if port not in whitelist:
            cli("conf t")
            cli("interface %s" % port)
            cli("shutdown")
    But the python script is a bit complecs because it shoud find triggered interfece in log.
    Is it possible to use event parameters? And how?
    I know that they are:
    sw1# sh event manager history events det
    Event ID Time of Event        Event Type                   Slot       Policies
    32       09/30/2013 15:40:51  storm_control                active(1)  shut-storm
        interface = "Ethernet1/16", cause = "storm-control"

    Thank you Joseph.
    It works.
    Now the applet looks like:
    event manager applet shut-storm2
      event storm-control
      action 1.0 cli local python bootflash:shut-storm2.py $interface
    And the script:
    from cisco import cli
    from syslog import syslog
    import sys
    whitelist = [
    "Ethernet1/1",
    "Ethernet1/2"]
    port = sys.argv[1]
    if port not in whitelist:
      cli("conf t")
      cli("interface %s" % port)
      cli("shutdown")
      syslog(2, "Interface %s was shutdown due to storm conditions" % port)

  • How to use Import parameters of a search help

    Hi,
    Could you please tell me how to use import & export parameters of a search help in the report.

    Hi,
    Import parameters are imported from the selection screen of the report into the search help and then these are used to query in the search help.
    For example
    case 1.
    parameters : p_carrid like sflight-carrid.
    parameters : p_connid like sflight-connid.
    the search help that is used in the above condition is
    SFLIGHT.
    And the selection method is SFLIGHT in this search help.
    ( to check which search help is used go to se11 display the table and put your cursor on the field and in the menu for goto--> search help.)
    so when you do an F4 on connid it looks for a field which is declared like SFLIGHT-CARRID ( and the value entered in it) since the SFLIGHT-CARRRID is an import parameter in the search help,  and queries the database where the value is equal to the p_carrid which is declared like SFLIGHT-CARRID and gets only data which is equal to carrid
    case 2.
    parameters : p_carrid like SCARR-carrid.
    parameters : p_connid like sflight-connid.
    In this case the system will fetch all the data.
    since there is no parameter for SFLIGHT-CARRID on the selection screen it would get all the data from SFLIGHT.

  • How to use default values of variables when data get varied

    Hi Expert,
    I want to use default value of variables var1.
    for eg. if variable length is 20 char and value is abc , then i want to fill var1 by default 20 ( after printing abc value remaining length i.e.17 should be taken by var1 means total length 20 should be occupy by var1.)
    plz reply
    Regards,
    Jyotsna

    Hello Jyotsna,
    I dont really understand the example you have quoted. Can you elaborate your example?
    Vikranth

  • How to use init parameters?

    Is it posible to use init parameters with FacesServlet?
    With any other servlet I'd do this:
    <servlet>
    - <init-param>
      <param-name>base</param-name>
      <param-value>/shop</param-value>
      </init-param>
    </servlet>but it doesn't seem correct to the same with the FacesServlet ie:
    <servlet>
      <servlet-name>Faces Servlet</servlet-name>
      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
    - <init-param>
      <param-name>imageURL</param-name>
      <param-value>/images/</param-value>
      </init-param>What is the right way to use init params with JSF?

    You don't have control over the FacesServlet.
    Rather use the context-param.
    <context-param>
        <param-name>paramName</param-name>
        <param-value>paramValue</param-value>
    </context-param>
    String paramName = facesContext.getExternalContext().getInitParameter("paramName");

  • How to use URL parameters in Flex?

    Hello Everyone,
    I wanted to know how can the parameters passed in a URL be used in our Flex application. I searched in the forum and tried these links:
    http://forums.adobe.com/message/217950#217950
    http://www.danvega.org/blog/index.cfm/2009/2/5/Flex-FlashVars-in-local-development
    In the second link, this is the solution provided:
       1. // if we've detected an acceptable version
       2. // embed the Flash Content SWF when all tests are passed
       3. AC_FL_RunContent(
       4.         "src", "ffManager",
       5.         "width", "100%",
       6.         "height", "100%",
       7.         "align", "middle",
       8.         "id", "ffManager",
       9.         "quality", "high",
      10.         "bgcolor", "#869ca7",
      11.         "name", "FFManager",
      12.         "allowScriptAccess","sameDomain",
      13.         "type", "application/x-shockwave-flash",
      14.         "pluginspage", "http://www.adobe.com/go/getflashplayer",
      15.         "flashvars","username=dvega"
      16. );
    private function init():void {
        // grab the username so we can track who is logged in
        [Bindable] private var:username= Application.application.parameters.username;
    But here, I am getting the hardcoded value (ie.,dvega) as the data inside my flex application. Instead I would need the dynamic data that is passed through the URL. For Ex: if I use the URL, http://172.22.41.154/MH_2.html?myName=Arush
    I need would need to use the name 'Arush' inside the application. Can you please help me on how and what part of the code is to be modified?
    Thank you,
    Warm regards,
    Deepak

    That would come within flex.
    In my case, there is a SAP CRM web application which has a push button. On click of this button, flex URL is called(ie., http://172.22.41.154/MH_Bluebook_Integration2.html). On click of that button I need to pass an Object ID, which is passed withing that flex URL, something like this:
    http://172.22.41.154/MH_Bluebook_Integration2.html?objID=abcd
    I need to receive 'abcd' in the flex. Any way we could modify the HTML wrapper to send this value to swf? 

  • How to Use Default Item Category in a Shared Instance

    Hi Gurus,
    Hope you all are doing well.
    We have very critical issue. Infact we are implementing Oracle 12.1.3 for a Customer who is using a shared instance with another country. Infact the other country has already set Default Item Category Set, Now we also want ours.
    How to Achieve the same, Please let me know.
    We are also defining PO Approval Group Item Category range wise but there our category is not reflecting.
    Please suggest me how to go about this.
    Regards,
    Aditya

    911765 wrote:
    Hi Mahendra,
    Shared instance means our customer has one single Business in Differennt Countries.
    So they have already implemented for Indonesia Business and they have their own Ledger, OU and Inv Orgs etc.
    Now we are implementing for India Business. So Default Category has been set by Indonesia team already.
    But according to standard functionality of Oracle Default Category Set only reflect everywhere.
    So the issue is we want to also use our category so that it will reflect while Creating POs, In Approval Group and in other place.
    How to achieve the same ?
    I hope this will give you the clarity.
    Regards,
    AdityaFor one functional area we can have only one default category set
    you need to define different categories in the flexfield value set...ex PO Item Category
    so after defining them..you should be able to see them in item categories in purchasing approval groups
    Also check if any values are been defaulted from the value set of the segment..
    Like say..if value set has been set to dependent..with some default value...in that case you need to attach differnet value set to it..with new values..
    HTH
    Mahendra

  • How to use additional parameters in SM49

    Hi,
    I wrote a CMD file witch copies a file from one directory to another, the source and destention are both parameteres,
    how do I sent the 2 parameters using SM49?
    the command file looks like this:
    copy %1% %2%
    The system is windows
    Thanks,
    Naama.

    Right click on the References node in the project navigator and select: Add New Library Reference. In the subsequent dialog, specify the path to the jar file you wish to include. This library will be automatically added to the application classpath at design time and deployed with the application when you run the project.

  • How to use Style Parameters ?

    Hi,
    in JDEV I have created a VO with a query (pasted from sqlplus) that does a select cross a couple of tables. I need to parameterise the query but cant see how to do it. It looks like you could use
    ' where table.atttribute = :1' as part of the query in the View Object designer. Selecting the check box ? Style Parameters means the sql tests as valid. But when you apply the changes you get a value not bound error.
    How do you get the parameter from (for example) a form value, into the view ? Is there a way to do this and ignore the variable not bound error mentioned above ?
    Seems like it should be intuitive, but I've obviously missed that bit of the developers guide :-)
    Any pointers would be great.
    Paul

    There is no direct way to bind the Form Fields to the query.
    You need to do the following:
    Use the pageContext.getParameter("param_name") to get the value for the form field.
    Use the am.invokeMethod to bind the variable as below in your view method:
    setWhereClauseParams(null); // Always reset
    setWhereClause(null);
    setWhereClauseParam(0,qotHdrId);
    executeQuery();
    This should work. Hope this helps.

  • How to use DATETIME parameters in stored procedure?

    I can not define a variable or parameters
    with data type of DATETIME
    when I define stored procedure using Developer/2000.
    Does Oracle not support DATETIME?
    null

    Chen Honghua (guest) wrote:
    : I can not define a variable or parameters
    : with data type of DATETIME
    : when I define stored procedure using Developer/2000.
    : Does Oracle not support DATETIME?
    Oracle supports DATETIME data type.
    "DATETIME" data type is stored in "DATE" data type.
    if you want to DEFINE "10-Jan-1998 10:20" :
    declare
    dummy_date date:=to_date('10-jan-1998 10:00','DD-MON-YYYY
    HH24:MI');
    BEGIN
    END;
    null

Maybe you are looking for

  • How do I erase a specific Photo on the "Photo Album Cover" on Apple TV???

    I have removed a certain photo from All of my devices. I have reset Photostream on all of these devices and I have reset Photostream in iCloud. I have restarted all of my devices in order to completely erase this particular photo. Now the photo is, a

  • Pulse dialling only !! Help please

    Hello, I am about at the end of my tether.....I have moved into a new build property and have a BT home hub.  For some reason which is beyond my comprehension I am unable to dial out unless I set my phone to 'pulse' dialling instead of 'tone' This me

  • Ex Rate diff A/c : Tax code

    Dear All, We are clearing the Customer open items using Transaction F-28. There are automatically generated line items for the exchange rate difference, when we run F-28. In the simulation mode, we want to correct this automatically generated line it

  • How reset Tracking=0 in Illustrator?

    Why do i can't set Tracking of character =0   ? Set : oCharRange.CharacterAttributes.Tracking = 0 Result after set oCharRange.CharacterAttributes.Tracking =-30 But i set number <> 0 ok How reset Tracking=0 in Illustrator?

  • "cannot execute CGI script " error

    Greetings. I am trying to setup a Sun One version 6.1 server. When I try to run a simple cgi script, with a .pl suffix, I get: "cannot execute CGI script " Is there anything in particular I should look for in resolving hte problem ? Thanks. alan