I can't execute oracle functions with c#.  i'm using oracle 9i version.

i have a problem trying to execute an oracle function with c#.net. The Oracle version i'm using is Oracle 9i.
This is the function definition: (it's defined and working right because i have tryed it with SQLWorksheet)
CREATE OR REPLACE Function NRegistros return integer is
Numero integer(4);
begin
select count(*) into Numero from singles;
return Numero;
END NRegistros;
But with c#.Net i can't acces it because i get an error: "this is not a procedure or is not defined". And i think the code is right. In fact in the same code you can see that i'm using an stored procedure and i have not problems. But with the function i have problems. Is it possible that "OracleClient" can't work with Oracle9i functions??. This is the code:
OracleParameter Parametro = new OracleParameter("Name", OracleType.VarChar,10);
OracleParameter ParametroFuncion = new OracleParameter("Retorno", OracleType.Int32, 4);
Parametro.Direction = ParameterDirection.Output;
ParametroFuncion.Direction = ParameterDirection.ReturnValue;
OracleConnection Conexion = new OracleConnection("Data Source=DISCOS;User Id=SYSTEM;Password=a0000;");
Conexion.Open();
OracleCommand Todos = new OracleCommand();
OracleCommand Procedimiento = new OracleCommand();
OracleCommand Funcion = new OracleCommand();
Todos.Connection = Conexion;
Todos.CommandType = CommandType.Text;
Todos.CommandText="select * from singles";
Procedimiento.Connection = Conexion;
Procedimiento.CommandType = CommandType.StoredProcedure;
Procedimiento.CommandText = "Procedimiento";
Procedimiento.Parameters.Add(Parametro);
Funcion.Connection = Conexion;
Funcion.CommandType = CommandType.StoredProcedure;
Funcion.CommandText = "NRegistros";
OracleDataReader Lector = Todos.ExecuteReader();
BindingSource Discos = new BindingSource();
Discos.DataSource = Lector;
dgvSingles.DataSource = Discos;
Procedimiento.ExecuteNonQuery();
Funcion.ExecuteNonQuery();
lblRegistroProcedimiento.Text = Procedimiento.Parameters["Name"].Value.ToString();
lblNregistros.Text=Funcion.Parameters["Retorno"].Value.ToString();
Conexion.Close();
Edited by: user11921281 on 22-nov-2009 20:32

thank you very much. It was a stupid error, sorry. There was one line left :
OracleParameter Parametro = new OracleParameter("Name", OracleType.VarChar,10);
OracleParameter ParametroFuncion = new OracleParameter("Retorno", OracleType.Int32, 4);
Parametro.Direction = ParameterDirection.Output;
ParametroFuncion.Direction = ParameterDirection.ReturnValue;
OracleConnection Conexion = new OracleConnection("Data Source=DISCOS;User Id=SYSTEM;Password=a0000;");
Conexion.Open();
OracleCommand Todos = new OracleCommand();
OracleCommand Procedimiento = new OracleCommand();
OracleCommand Funcion = new OracleCommand();
Todos.Connection = Conexion;
Todos.CommandType = CommandType.Text;
Todos.CommandText="select * from singles";
Procedimiento.Connection = Conexion;
Procedimiento.CommandType = CommandType.StoredProcedure;
Procedimiento.CommandText = "Procedimiento";
Procedimiento.Parameters.Add(Parametro);
Funcion.Connection = Conexion;
Funcion.CommandType = CommandType.StoredProcedure;
Funcion.CommandText = "NRegistros";
Funcion.Parameters.Add(ParametroFuncion); //<--------------------- That one !!! (yes it was a stupid error jeje)
OracleDataReader Lector = Todos.ExecuteReader();
BindingSource Discos = new BindingSource();
Discos.DataSource = Lector;
dgvSingles.DataSource = Discos;
Procedimiento.ExecuteNonQuery();
Funcion.ExecuteNonQuery();
lblRegistroProcedimiento.Text = Procedimiento.Parameters["Name"].Value.ToString();
lblNregistros.Text=Funcion.Parameters["Retorno"].Value.ToString();
Conexion.Close();

Similar Messages

  • How to use oracle functions in Crystal Reports XI using Oracle Server

    Hi all,
    Is it possible  to use oracle functions in Crystal Reports XI using Oracle Server as Data Source.
    If i try to use a procedure,i am getting error with message "Invalid Arguement Provided".
    Functions are not visible objects like tables,views and stored procedures.
    The  jdbs driver i m using is oracle.jdbc.driver.OracleDriver.

    I think it is not possible to add functions in crystal directly for any database. You need to use those functions in a stored procedure and add that storedprocedure as a datasource.
    [https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233353335333833323333%7D.do]
    regards,
    Raghavendra

  • Execute K_BATCH_REQUEST function with another user

    Hello,
    I would like to execute the function K_BATCH_REQUEST with another user-name (a batch name) but I do not found any option to execute this function with another user.
    Someone can help me ??
    <removed by moderator>
    thanks a lot in advance for your help.
    Daniel
    Edited by: Thomas Zloch on Nov 14, 2011 3:02 PM

    Suppose the FM signature looks like
    FUNCTION ztest.
    *"*"Interface locale :
    *"  IMPORTING
    *"     REFERENCE(PAR1) TYPE  C
    *"  TABLES
    *"      TAB1 STRUCTURE MARA
    A wrapper program could look like
    REPORT  ztestwrapper.
    TYPES tmara TYPE mara OCCURS 10.
    * no-display allows much more flexibility here
    PARAMETERS: par1 TYPE c NO-DISPLAY,
                tab1 TYPE tmara NO-DISPLAY.
    CALL FUNCTION 'ZTEST'
      EXPORTING
        par1 = par1
      TABLES
        tab1 = tab1.
    For the scheduling of the job read [Task Overview: Full-Control Job Scheduling|http://help.sap.com/saphelp_470/helpdata/en/fa/096cf2543b11d1898e0000e8322d00/frameset.htm]
    Regards,
    Raymond

  • Can I execute a function module in my  Webdynpro App ?

    Hi,
    Can I execute a function module in my Webdynpro App ?  I mean, it's not a BAPI.
    Is it possible ?   which is the procedure to follow ?  (comparing to a bapi procedure).
    Thanks for your help !
    Regards from Mexico.  =)
    Diego

    Hi Diego,
    the warning icon indicates that you're using a function module that has not been externally released. If the corresponding function module has been defined by SAP, its interface might be changed in an incompatible way within one of the next releases, e.g. removing / renaming a parameter or structure field. Stability is only guaranteed for BAPIs or external released function modules.
    From the point of view of the model import it does not make any difference. If import does not work, there seems to be some other problem. Maybe the function module has not been activated in the R/3 system. Or check the log file or the import log page which will be the last page of the import wizard.
    You might want to import some other none external released function module in order to verify that model import of these kind of function module works.
    Kind regards,
    Lothar Bender

  • Can I Execute a function whose name is stored in a string variable?

    Can I execute a function whose name is stored in a string variable?
    Like
    Depending on the condition I will stroed the name of the function in a string variable. Then using that string variable i want to execute the function.
    String str=��
    iVal an int can take ne value
    Switch(iVal)
    Case 1:
    str=�test1()�;
    Case 2:
    str=�test2()�;
    I want whatever function name is in str to be executed.
    ----------------------------------------------------------------------------------

    For just executing a method or two, reflection might be easier than beanshell (or it might not). For executing entire scripts, beanshell will be preferable over reflection.
    (I assume beanshell uses reflection under the hood, but I've never bothered to peek.)

  • Debug an oracle function with toad 7.4, oracle 9i

    Hello,
    i wanna debug an oracle function with toad 7.4
    so i wanna give param to this function and fix breakpoint and verfy some variables values ... etc
    could you show me how debug it?
    Thanks
    Regards
    Elyes

    Do you have the Toad Debugger? Thats the extra cost option which you get for free in OracleSqlDeveloper.
    If you have the ToadDebugger, Read the Manual
    If not , download OracleSqlDeveloper and use it. It's free, and written by Oracle.

  • Can I have multiple iPhones with unique back ups using one icloud account?

    Hello forum users,
    Can I have multiple iPhones with unique back ups using one icloud account?
    I would like to back up and restore 4 different iPhones, 1 iPad, a MacBook and 1 MacBook Pro using the same single iCloud account.
    If so, how is this done?
    Many thanks

    Sharing an iCloud account between two devices can be done without causing issues with iMessage and FaceTime, just go into Settings for each of these functions and designate separate points of contact (i.e. phone number only, or phone number and unique email address).  While that works, you'll then face the problem where a phone call to one iPhone will ring both if on the same Wi-Fi network -- but again, that can be avoided by changing each phone's settings.
    Rather than do all that, don't fight it -- use separate IDs for iCloud.  You can still use a common ID for iTunes purchases (the ID for purchases and iCloud do not have to be the same) or you can use Family Sharing to share purchases from a primary Apple account.

  • Unable to connect to my Oracle Database with Microsoft's ODBC for Oracle driver

    I am unable to connect to my Oracle Database with Microsoft's ODBC for Oracle driver vers.2.573.4202.00 on a Win98 computer.
    First, I create a "Net Service Name" in order for the ODBC Driver to find the Oracle server. I then created a System DSN in the ODBC Data Source Administrator and assigned the "Net Server Name" as the server in the "Microsoft ODBC for Oracle Setup". But when I test this DSN with Oracle's provided "Oracle ODBC 32Bit Test vers.2.5.3.1.0" I get an error:
    SQLSTATE: NA000
    Native Error Code:0
    Driver Message:[Microsoft][ODBC driver for Oracle][Oracle]
    This error occurred on all three Win98 computers I have tried. It does however, seem to work fine on WinNT 4.0, and believe it or not, on the two Win95 computers I have tried.
    Does anyone have any fixes, recomendations, or advice?
    Thank you,
    Eric Edwards
    null

    Why are yu not using the Oracle ODBC driver - these can be downloaded from OTN.
    Have you set up a tnsnames.ora entry for the Oracle database you want to connect to? Does this name have a domain name added to it? Check %ORACLE_HOME%\network\admin\tnsnames.ora for the service name. If it is a name of the form :
    name.domain.subdomain
    then you should try using this full name when configuring the ODBC data source.
    null

  • How can I associate 2 appleids with one account or use a different Appleid for imessage as described in another post?

    How can I associate 2 appleids with one account or use a different Appleid for imessage as described in another post?
    I have rejoined the iPhone community, not with one iPhone but with two. My wife agreed to move from the unenlightened!
    I have set up both under my apple account and want to keep it that way. But I do not want iMessages going to both phones. I would like separate message queues but share all apps and other purches from the store.
    I have created a separate AppleID for her but under Settings>Message>Receive At (it currently says 2 addresses) > ... will not allow me to change the current eMail address and when I add hers (her appleid) it errors out. The only thing I can do in the Apple ID field is to manage my account and not change it to hers.
    How can I have 2 iPhones (and my iPad) on the same account but have separate identies?
    Thanks,
    LpGrumpy

    1. Yes. Restart with the Option key held down as needed.
    2. No, it won't be a problem.
    (83373)

  • Hi, I have imac mac os 10.6.7, I can't access to internet with my ipod  touch using my imac airport...what's wrong? my ipod tells me is connected and airport is active...so? what should I do?

    Hi,
    I have imac mac os 10.6.7, I can't access to internet with my ipod  touch using my imac airport...what's wrong? my ipod tells me is connected and airport is active...so? what should I do?

    right, figured it out. had to put it in disk mode, then reconnect, then it was recognized, then i restored and put everything back onto it. hope this helps anyone else who has a similar problem

  • Can't Drag and Drop with a Double Tap using Single Finger in Lion?

    I installed the Mac OS X Lion two days. But I can't drag and drop with a Double tap using Single Finger, which I used to do in Snow Leopard.
    If I choose Three Finger Move, then Swap Between Pages goes back to "Scroll left or right with Two Fingers" that only works with Safari, but doesn't work with Chrome or Firefox.
    I tried literally every setting in Trackpad and also checked if there was a override settings and there is no overrride setting.
    Would be thankful, if you guys could suggest me what to do?
    ======================================
    My Machine Configuration:
    Macbook Pro 13" (mid 2010)
    Intel Core 2 Duo 2.4GHz
    4GB Ram
    Nvidia Geforce 320m
    Mac OS X Lion (Installe on a updated Snow Leopard 10.6.8)

    Hey Serge many thanks for telling me how to do. now its working like previously
    I just cheked the Dragging under Trackpad option and unchecked Three Finger Moves. now I can drag and drop with a double tap using single finger.
    Thank you guys. You are the best

  • Do I need to purchase an iPad with cellular to use imaps or can I purchase an iPad with wifi only and use the data connection on my iPhone.

    Do I need to purchase an iPad with cellular to use imaps or can I purchase an iPad with wifi only and use the data connection on my iPhone.
    My aim is to have maps on the bigger iPad screen.

    the wifi version don't have an gps chip

  • JDBC-ORACLE CONNECTIVITY ISSUE WITYH OCI8 DRIVER using oracle 11g client..

    JDBC-ORACLE CONNECTIVITY ISSUE WITYH OCI8 DRIVER using oracle 11g client..
    I am getting below error when i m trying to access oracle db using oracle 11g client. It works with earlier oracle client versions. how do i resolve this. is there any issue with version of ojdbc6.jar that i am using??? I cant use thin driver since its an old application for which i dont have source files.
    Apr 6, 2013 1:00:59 PM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
    at java.lang.Runtime.loadLibrary0(Runtime.java:822)
    at java.lang.System.loadLibrary(System.java:992)
    at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:262)
    at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:346)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
    at java.sql.DriverManager.getConnection(DriverManager.java:525)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at PettyCash.SysDate.getSysSubSys(SysDate.java:232)
    at org.apache.jsp.PettyCash.index_jsp._jspService(org.apache.jsp.PettyCash.index_jsp:186)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    Code is as follow for reference
    import oracle.jdbc.driver.*;
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    conn = DriverManager.getConnection ("jdbc:oracle:oci8:@" + database,db_user, db_pass);
    eNVIRONMENT VARIABLES set are as follows:
    classpath
    C:\Program Files\apache-tomcat-5.5.12\common\lib\servlet-api.jar;C:\Program Files\apache-tomcat-5.5.12\webapps\ROOT\WEB-INF\lib\classes12.jar;C:\Program Files\apache-tomcat-5.5.12\webapps\ROOT\WEB-INF\lib\ojdbc6.jar;
    JAVA_HOME
    C:\Program Files\Java\jdk1.5.0_04
    PATH
    C:\Program Files\Java\jdk1.5.0_04\bin
    ORACLE_HOME
    D:\Oracle11\product\11.2.0\client_1\BIN

    Apr 8, 2013 5:24:06 PM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    java.lang.NullPointerException
         at org.apache.jsp.abc.index_jsp._jspService(org.apache.jsp.abc.index_jsp:280)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)

  • How can I execute a Procedure with OUT variable is %ROWTYPE on SQL Prompt

    Hi,
    I have a procedure with OUT variable is %ROWTYPE
    How can I execute the following procedure on SQL prompt.
    (without creating anonymous block)
    CREATE OR REPLACE PROCEDURE zz_sp_EMP(VEMPNO IN EMP.EMPNO%TYPE,
    V_REC IN OUT EMP%ROWTYPE)
    AS
    BEGIN
    SELECT * INTO V_REC FROM EMP WHERE EMPNO = VEMPNO;
    END;
    Thanks & Regards,
    Naresh

    as previous posters said: it's not possible to do this without declaring a variable in the anonymous block.
    With anonymous block it would look like this (had to change it a bit, since i'm using hr-schema on oracle XE):
    declare
    l_rec EMPLOYEES%ROWTYPE;
    begin
    zz_sp_EMP(VEMPNO => 100, V_REC => l_rec);
    DBMS_OUTPUT.PUT_LINE ( 'first_name = ' || l_rec.first_name );
    DBMS_OUTPUT.PUT_LINE ( 'last_name = ' || l_rec.last_name );
    end;
    first_name = Steven
    last_name = King

  • Oracle functions with PowerPivot

    Hi All,
    I have a requirement of building reports using Oracle functions in PowerPivot.
    I have tried using Table Import Wizard and Command Type=StoredProcedure in th ePowerPivot.
    Any help will be appreciated.
    Thanks and Regards,
    SS

    Hello,
    I don't think we can use Oracle functions/stored procedures in PowerPivot, please see the similar thread below:
    http://social.technet.microsoft.com/Forums/en-US/22e67f7f-0753-4f21-bae2-1812d2daf03e/powerpivot-oracle-stored-procedure-err-the-sql-statement-is-not-valid-there-are-no-columns?forum=sqlkjpowerpivotforexcel
    I would suggest you elaborate your requirement with more detail.  
    Regards,
    Elvis Long
    TechNet Community Support

Maybe you are looking for

  • Unbelieveably p****d off trying to install itunes - I'll PAY for help

    I have just wasted over 2 hours trying to downlaod a boook from Audible - I need to install itunes and I get a message from iTunes + Quicktime that says "Could not open key: HKLOCALMACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run. Verify that yo

  • SRM general questions

    Hi, I am new to SRM and have some basic questions. 1. What are the restrictions of classic scenario ? 2. What are the restrictions of extended classic scenario? 3. I want to know how organizational structure is impacted in classic scenario and extend

  • Insert delimiters

    Hi, I tried to insert Pipe-Delimiters at positions in text file, but i get this error, please some can help sort it. $path ="c:\bkps\sample.txt" $Positions=@(2,9,16,32) $dat = Get-Content $path $Positions | foreach {$dat $dat=$dat.Insert($_,'|') $dat

  • Mac Pro 3ghz always 1 prosessor working at 100% speed

    Hello, I have a new Mac Pro 3ghz and 2Gb ram and osx 10.4.8 I notist that always 1 prosessor is working at 100% speed. It is coninualy switching from processor to processor, but alway 1 is working at 100% speed. I dont think this is normal, and i thi

  • Why can't I delete an event in the All Events window pane in iMovie 10

    Hi, I can't delete an event using select event, file, send event to trash can. It says: The operation cannot be completed. The Library must contain at least one Event. When I hover on the event pane I can see different parts of the clip. I don't want