How Create procedure or function with ADO ?

Hello,
How Create procedure or function with ADO?It's my question.
Thanks.
Henri

This message if post by Taiwan-ChangHaw-Oracle-Stored-Procedure-For-Business-Rule-Club
public bool ConnectDatabase()
try
{ string strConnectionString =
"Provider=OraOLEDB.Oracle" +";"+
     "Data Source=" + ConnectionParams.Datasource +";"+
"User Id =" + ConnectionParams.Username +";"+
"Password =" + ConnectionParams.Password;
     m_conn=new ADODB.Connection();
     m_conn.ConnectionString=strConnectionString;
     m_conn.Open("","","",0); //i_"YYAOl Open the connection
catch(Exception e)
{     System.Windows.Forms.MessageBox.Show(e.Message);
     return false;
return true; //YYAOl_B>3I9&connected successfully
public void InsertDescription(string p_product,string p_language,string p_tname,string p_tdescription)
{ string sql="{Call inserttranslateddescription(?,?,?,?,?)}";
try
{ ADODB._Command cmd=new ADODB.Command();//Create a command object
cmd.ActiveConnection=m_conn; //Set its active connection to open connection
ADODB.Properties properties=cmd.Properties;//Get the command properties into ADODB Properties object
IEnumerator ienum=properties.GetEnumerator();//Get an enumerator on above properties
ADODB.Property singleprop;
while(ienum.MoveNext()) //iterate through the enumerator
     {singleprop=(ADODB.Property)ienum.Current;//Get the current property from enumerator
     string propname= singleprop.Name; //Get the name of current property
     if(propname.Equals("NDatatype")) //if the property is 'NDatatype' set its value to true
     singleprop.Value=true;
cmd.CommandType=ADODB.CommandTypeEnum.adCmdText;
int pid=Int32.Parse(p_product);
ADODB._Parameter langid     =cmd.CreateParameter("langid",          ADODB.DataTypeEnum.adChar,ADODB.ParameterDirectionEnum.adParamInput, 100,p_language);
ADODB._Parameter productid =cmd.CreateParameter("productid",     ADODB.DataTypeEnum.adNumeric,ADODB.ParameterDirectionEnum.adParamInput, 100,pid);
ADODB._Parameter tname =cmd.CreateParameter("tname",          ADODB.DataTypeEnum.adBSTR,ADODB.ParameterDirectionEnum.adParamInput, 50,p_tname);
ADODB._Parameter tdescription=cmd.CreateParameter("tdescription",ADODB.DataTypeEnum.adBSTR,ADODB.ParameterDirectionEnum.adParamInput, 50,p_tdescription);
ADODB._Parameter check          =cmd.CreateParameter("check",          ADODB.DataTypeEnum.adNumeric,ADODB.ParameterDirectionEnum.adParamOutput,100,0);
cmd.Parameters.Append(langid);
cmd.Parameters.Append(productid);
cmd.Parameters.Append(tname);
cmd.Parameters.Append(tdescription);
cmd.Parameters.Append(check);
cmd.CommandText=sql;
//Execute the command to insert product details in database
object recs;
object param=p_language;
cmd.Execute(out recs,ref param,1);
ienum.Reset();
while(ienum.MoveNext()) //iterate through enumerator
{ singleprop=(ADODB.Property)ienum.Current;//Get the current property in to Property object
string propname= singleprop.Name; //Get the name of current property
if(propname.Equals("NDatatype")) //if it is 'NDatatype' set its value to true
singleprop.Value=false;
IEnumerator iprop=cmd.Parameters.GetEnumerator();//Get the enumerator for command parameters
while(iprop.MoveNext()) //loop through enumerator
{ //Get the current parameter in enumerator
ADODB._Parameter checkval=(ADODB._Parameter)iprop.Current;
if(checkval.Name.Equals("check")) //if the parameter is 'check'
if(checkval.Value.ToString().Equals("0")) //If check's value is zero data was inserted
System.Windows.Forms.MessageBox.Show("Product details Inserted successfully");
else
System.Windows.Forms.MessageBox.Show("Product Details Updated");//else data was updated
catch(Exception e)
System.Windows.Forms.MessageBox.Show(e.Message);//Display any error message
}

Similar Messages

  • How to call a package with ADO?

    I have designed a package which include a procedure. And I have a program coded in ASP.
    How to call this package with ADO. Please give a sample.

    Hi,
    I persume that you are facing this problem when u try to code in VB. If that is the case here comes the code.........
    OraDatabase.Parameters.Add "A_NBR_NEWSID", A_NBR_NEWSID, ORAPARM_INPUT, 2
    OraDatabase.Parameters.Add "A_NBR_TOPICID", A_NBR_TOPICID, ORAPARM_INPUT, 2
    OraDatabase.Parameters.Add "A_NBR_USERID", A_NBR_USERID, ORAPARM_INPUT, 2
    OraDatabase.Parameters.Add "result", 0, ORAPARM_OUTPUT
    OraDatabase.Parameters("result").serverType = 2
    OraDatabase.ExecuteSQL ("declare result Number; Begin :result := PKG_CONTENT_MANAGEMENT.FUN_GET_NEWS_PERM_BY_USERID(:A_NBR_NEWSID, :A_NBR_TOPICID, :A_NBR_USERID); end;")
    OraDatabase.Parameters.Remove "A_NBR_NEWSID"
    OraDatabase.Parameters.Remove "A_NBR_TOPICID"
    OraDatabase.Parameters.Remove "A_NBR_USERID"
    FUN_GET_NEWS_PERM_BY_USERID = OraDatabase.Parameters("result").Value
    OraDatabase.Parameters.Remove "result"
    Hope this clear your doubt..
    Raj

  • How to use TRUNC function with dates in Expression Builder in OBIEE.

    Hi There,
    How to use TRUNC function with dates in Expression Builder in OBIEE.
    TRUNC (SYSDATE, 'MM') returns '07/01/2010' where sysdate is '07/15/2010' in SQL. I need to use the same thing in expression builder in BMM layer logical column.
    Thanks in advance

    use this instead:
    TIMESTAMPADD(SQL_TSI_DAY, ( DAYOFMONTH(CURRENT_DATE) * -1) + 1, CURRENT_DATE)

  • How to use INVOKE function with INT parameter types

    Can you tell me how to use invoke function with int parameter type ?

    Pass the int as an Integer.

  • How to link Partner function with EDI ?

    Hi all,
    While sending PO thourgh EDI i am getting some error message...Partner function is not assigned with EDI..this message is not coming with ALE.
    Can any body help me to "How to link Partner function with EDI "?
    Thanks in advance.
    ankush

    Hi Ankush,
    Perhaps unintentionally, you are not rewarding points for correct answers, instead of clicking on the radio button"AWARD POINTS", you are clicking  "SOLVED BY OWN".
    and no points are being given from your side.
    Please award points if you find the answers helpful.
    Now also you can award points first, unassign by clicking again and then assign to whomsoever you think deserves.
    Regards,
    Sachendra Singh

  • How to call java function with parameter from javascript in adf mobile?

    how to call java function with parameter from javascript in adf mobile?

    The ADF Mobile Container Utilities API may be used from JavaScript or Java.
    Application Container APIs - 11g Release 2 (11.1.2.4.0)

  • Why thr r 2 options Is/As while creating procedure or function

    why there are 2 options avialable IS/AS while creating procedure or function ?
    Like
    create or replace procedure test (p_nbr NUMBER) AS
    create or replace procedure test (p_nbr NUMBER) IS
    tried both the options observed same result..
    Is thr any differnce between IS and AS ?

    SShubhangi wrote:
    why there are 2 options avialable IS/AS while creating procedure or function ?
    Like
    create or replace procedure test (p_nbr NUMBER) AS
    create or replace procedure test (p_nbr NUMBER) IS
    tried both the options observed same result..
    Is thr any differnce between IS and AS ?Technically... there is no difference.
    In terms of the English language, it would depend what you're describing...
    [ do some action ] AS follows...
    [ this object ] IS defined like this...
    So in programming language terms you could say that:
    create or replace procedure test (p_nbr NUMBER) AS...reads more naturally than
    create or replace procedure test (p_nbr NUMBER) IS...because it is an "action" of creating or replacing something.
    whereas, for example, a procedure in a package...
    procedure test (p_nbr NUMBER) IS...is more clear than
    procedure test (p_nbr NUMBER) AS...because this is stating what the procedure IS, rather than an action of creating it. (the package itself would be "create package ... AS")
    As far as Oracle is concerned though, it doesn't care, they are both interchangable. For me personally, I like to use the one that makes it clearly readable.

  • How to write a function with table name as parameter

    I created a function like this:
    create or replace function "GETNAME"
    (did in NUMBER, dtable in VARCHAR2)
    return VARCHAR2
    is
    dname varchar2(200);
    begin
    select lastname || ' ' || firstname
    into dname from dtable
    where id = did;
    return dname;
    end;
    i got an error: table or view does not exist.
    Could somebody tell me how to fix it?
    Thanks,
    Jen

    or by using a reference cursor:  create or replace function dynamic_cursor (pTab varchar2)
        return sys_refcursor as
        c sys_refcursor;
      begin
        open c for 'select * from '|| pTab;
        return c;
      end;
    SQL> exec :c := dnamic_cursor('emp');
    SQL> exec :c := dynamic_cursor('emp');
    PL/SQL procedure successfully completed.
    SQL> print c;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7566 JONES      MANAGER         7839 02-APR-81       2975       1000         20
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7788 SCOTT      ANALYST         7566 09-DEC-82       3000                    20
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 12-JAN-83       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
          7945 CINDY      SALESMAN        7698 16-JAN-83       1800                    30
          7950 TINA       SALESMAN        7698 18-JAN-83       1850                    30
    16 rows selected.
    SQL>

  • How to call a function with pl/sql

    How does one call a function with pl/sql that uses a function?

    Hi,
    How does one call a function with pl/sql that uses a
    function?I'm not sure what you mean.
    In PL/SQL function can be used just about anywhere where an expression (with the same data type that the function returns). Arpit gave a very common example.
    Here's another example, where all the functions take a single NUMBER argument and return a NUMBER, so they can all be used in places where NUMBERs are used:
    IF  fun_a (fun_b (0)) < fun_c (1)
    THEN
        UPDATE  table_x
        SET     column_y = fun_d (2)
        WHERE   column_z = fun_e (ROUND ((fun_f (3), fun_g (4)));You call a function simply by using its name, followed by its argument list, if any.
    If the function is in a package, you must call it with the package name, like "pk_foo.bar (1, 2, 3)", unless the call comes from within the same package.
    If the function is owned by someone else, you must give the owner name, like "scott.bar (SYSDATE)" or "scott.pk_foo.bar (1, 2, 3)". You can create synonyms to avoid having to name the owner.

  • Create procedure or function in pl/sql code

    Hi
    how can I to build a procedure or function in block PL/SQL using
    DECLARE
    BEGIN
    END

    may be this
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2  str varchar2(400);
      3  begin
      4   str:='create or replace procedure test_dy
      5         is
      6        begin
      7           null;
      8         end;';
      9    execute Immediate str;
    10* end;
    SQL> /
    PL/SQL procedure successfully completed.
    SQL> desc test_dy;
    PROCEDURE test_dy

  • How Create a Role just with EXECUTE grant

    Hi all.
    How can I create a role just with the execute flag.
    The default here at my site is the the select flag is marked.
    I´d like to know this because we have some logical models with more than 1500 procedures and I spend a lot of time waiting the response when I have to add a new procedure to a role then, if I create a role just with execute flag I just need to associate the procedure to the role.
    Thank you
    Darlei

    Hello Rajan,
    You have 2 options now :
    1. You can add the new Transaction codes to the existing profile, then go to the authorization objects and assign the required authorization over objects, regerate the profile and make user comparision. This is sory of composite profile concept.
    2. Go to SE93 , give the transaction code and check the authorization object. then under authorization object add this object manually and rest steps are same.
    BUt you can't find authorization object for all Tcodes via SE93. So its all your choice how you want to proceed.
    Best REgards
    Niraj

  • How to call a function with generic table parameter

    Hi everybody
    I need to call function module RSAR_ODS_API_GET (from BW). It recive an internal table with request ids and should return in E_T_DATA "unstructured" data from the psa and in E_T_RSFIELDTXT the description of the data structure, I guess
    from sap help only thing I have reggarding how to use the function module is :
    "You can call up the function module RSAR_ODS_API_GET with the list of request IDs given by the function module RSSM_API_REQUEST_GET. The function module RSAR_ODS_API_GET no longer recognizes InfoSources on the interface, rather it recognizes the request IDs instead. With the parameter I_T_SELECTIONS, you can restrict reading data records in the PSA table with reference to the fields of the transfer structure. In your program, the selections are filled and transferred to the parameter I_T_SELECTIONS.
    The import parameter causes the function module to output the data records in the parameter E_T_DATA. Data output is unstructured, since the function module RSAR_ODS_API_GET works generically, and therefore does not recognize the specific structure of the PSA. You can find information on the field in the PSA table using the parameter E_T_RSFIELDTXT."
    unfortunately I when running de report bellow, I get a dump which says:
    Function parameter "E_DATA" is unknown
    in the definition of the interface E_DATA has no type, which  means it can recive any table type, right?
    So I have two questions?
    1) How to get the code working
    2) How do I use the parameter E_T_RSFIELDTXT to parse the data returned in E_DATA
    by debuging RSSM_API_REQUEST_GET for this code I found it try to put an internal table with the struct of the database table /BIC/B0000151000 in E_DATA
    Thanks a lot for any help
    rgds
    my test report is:
    REPORT  ZTEST_PSA_API.
    TABLES: /BIC/B0000151000 .
    TYPE-POOLS: RSSM.
    TYPES: BEGIN OF STC_REQ_LINE,
      sign(1),
             option(2),
             low  TYPE rsa_request,
             high TYPE rsa_request,
             END OF STC_REQ_LINE,
      IT_REQUEST TYPE STC_REQ_LINE OCCURS 0.
    DATA: lit_request TYPE RSSM_T_API_REQUEST_GET WITH HEADER LINE,
          lc_system TYPE RSSM_T_API_LOGSYS,
          lit_request1 TYPE IT_REQUEST WITH HEADER LINE.
    DATA: lc_dtarget_name TYPE RSA_ODSNAME,
          lit_meta_data TYPE RSARC_T_RSFIELDTXT.
    DATA: lt_psa_data LIKE /BIC/B0000151000 OCCURS 0.
    CALL FUNCTION 'RSSM_API_REQUEST_GET'
      EXPORTING
        I_SOURCE    = '2LIS_13_VDITM'
        I_TYP       = 'D'
        I_DATEFROM  = '20060627'
      IMPORTING
        E_T_REQUEST = lit_request[]
        E_T_LOGSYS  = lc_system
        EXCEPTIONS  = 1.
    READ TABLE lit_request.
    lit_request1-sign = 'I'.
    lit_request1-option = 'EQ'.
    lit_request1-low = lit_request-request .
    APPEND lit_request1 .
    break-point .
    CALL FUNCTION 'RSAR_ODS_API_GET'
      EXPORTING
        I_T_REQUEST = lit_request1[]
      IMPORTING
        E_ODSNAME = lc_dtarget_name
        E_T_RSFIELDTXT = lit_meta_data
      TABLES
        E_DATA = lt_psa_data
      EXCEPTIONS
        NO_DATA_FOUND = 1
        PARAMETER_FAILURE = 2
        REQUEST_NOT_AVAILABLE = 3
        NO_REQUEST_FOUND = 4
        NO_FIELDS_TO_ODS = 5
        NO_ODS_FOUND = 6
        PACKAGE_LOCKED_BY_LOADING = 7 .

    Try to pass table parameter without "[]" :
    CALL FUNCTION 'RSAR_ODS_API_GET'
    EXPORTING
    I_T_REQUEST = lit_request1
    IMPORTING
    E_ODSNAME = lc_dtarget_name
    E_T_RSFIELDTXT = lit_meta_data
    TABLES
    E_DATA = lt_psa_data

  • How to use analytic function with aggregate function

    hello
    can we use analytic function and aggrgate function in same qurey? i tried to find any example on Net but not get any example how both of these function works together. Any link or example plz share with me
    Edited by: Oracle Studnet on Nov 15, 2009 10:29 PM

    select
    t1.region_name,
    t2.division_name,
    t3.month,
    t3.amount mthly_sales,
    max(t3.amount) over (partition by t1.region_name, t2.division_name)
    max_mthly_sales
    from
    region t1,
    division t2,
    sales t3
    where
    t1.region_id=t3.region_id
    and
    t2.division_id=t3.division_id
    and
    t3.year=2004
    Source:http://www.orafusion.com/art_anlytc.htm
    Here max (aggregate) and over partition by (analytic) function is in same query. So it means we can use aggregate and analytic function in same query and more than one analytic function in same query also.
    Hth
    Girish Sharma

  • How to use aggregate function with Date

    Hi All,
    I have a group of date from that is it possible to Max and Min of date.
    I have tried like this but its errored out <?MIN (current-group()/CREATION_DATE)?>.
    I have also tried like this but it doesnt works
    <?xdoxslt:minimum(CREATION_DATE)?>
    Is it possible to use aggregate function with date values.
    Thanks & Regards
    Srikkanth

    Hi KAVI PRIYA,
    if date is not in cannonical format, how can we change it in BI publisher, then how to calcualte minimum and as well as maximum.
    please advise me,
    Thanks,
    Sri

  • How to call a function with event

    How do I call a function with a event inside it?
    function showTopTen(e:Event):void
        highscoreData = new XML(e.target.data);
        trace("Hiscores: " + highscoreData.item[0].name.text() + " - " + highscoreData.item[0].score.text())
    //showTopTen();  ..??

    Could you indicate why you would want to?
    The eventhandler you show here uses the properties of the event object passed as an argument.
    The way I read it it is data retrieved from a server so your app won't know anything about is untill it is loaded from the server which should be done with an URLLoader object which in it's turn calls your eventHandler when the Event.COMPLETE is triggered.
    something like:
    var urlLoader = new URLLoader();
    urlLoader.addEventListener( Event.COMPLETE, showTopTen )
    urlLoader.load( new URLRequest( "http:// etc." ) );
    to me would seem the proper method to have the function execute.

Maybe you are looking for

  • Cannot see SWFVISU tasks in Portal UWL after re-registering

    Hi, I am using EP7.01 SP3, ESS 1.0 SP 15, ECC6. I do not see the tasks listed in SWFVISU in UWL even after registering the system alias in UWL Administrator. I have registered the alias on webflow connector, cleared cache. Logged off, logged on and I

  • Why are photos that are placed on the page not showing up in links panel?

    seems really random, I have 2 files that have several photos on them, but one photo on each is not showing in the links panel

  • No contact about when they will come to fix phone ...

    OK so on Monday I noticed our line was crackling quite badly. Since Tuesday we have been unable to make or recieve calls. You can still here the dial tone but nothing is registering on the phone. Our internet, which isn't BT has also gone down. I did

  • Limiting auth for FAGLB03 by Profit Center

    I am looking to limit the info that can be pulled from transaction FAGLB03 by profit center. I have tried adding profit center auth objects to the role.  I also used SU24- turning on K_PCA from No to Yes, but the user is still able to pull all data.

  • Buy Downloadable version of Flash 8

    I need to upgrade my flash in order to work on some documents someone created for me. I want to buy Flash 8, but I see Adobe has taken it off line. Does anyone know where I can buy a downloadable full version or even get a demo version that will last