Passing a long string from Vb to stored proc

Hi,
I am passing a long string from Vb to this stored proc ..
defn:
Create Or Replace Procedure saveTaxFormInDB(intFormUID IN number,
intCLUID IN number,
PDFdata IN varchar2,
Status IN OUT Varchar2) AS
Problem lies with the string pdfdata. I am sending it from VB as:
Set cmdParamStr = cmdAdoCmd.CreateParameter("Data", adVarChar,
adParamInput, 32767, strData)
I have checked the parameters in VB while sending and I have the
correct string argument to be passed to "PDFData", But i am not
sure if it is getting the value correctly.
Because I know that the code is raising exception while
accessing PDFData. (eg. in places like insert ..(pdfdata) and
length(pdfdata)...)
Please advise how i can solve this problem.
Please Note that the string is not VERY large. I do not need to
use LOBS in any way. the string is definitely within the limits
of varchar2(which i think is 4000 chars.. correct me if i am
wrong).
Many thanks

what is the backend MS SQl server or Oracle.??
If it is MS SQLSERVER, then
1.Create a SqlCommand object with the parameters as the name of the stored procedure that is to be executed and the connection object con to which the command is to be sent for execution.
SqlCommand command = new SqlCommand("Name of StoredProcedure",con);
2.Change the command objects CommandType property to stored procedure.
command.CommandType = CommandType.StoredProcedure;
3.Add the parameters to the command object using the Parameters collection and the SqlParameter class.
command.Parameters.Add(new SqlParameter("@parametername",SqlDbType.Int,0,"Filedname"));
4.Specify the values of the parameters using the Value property of the parameters
command.Parameters[0].Value=4;
command.Parameters[1].Value="ABC";
If it is oracle,
OracleConnection con = new OracleConnection("uid=;pwd=");
try
con.Open();
OracleCommand spcmd = new OracleCommand("Name of StoredProcedure");
spcmd.CommandType = CommandType.StoredProcedure;
spcmd.Connection = con;
spcmd.Parameters.Add("empid", OracleType.Number, 5).Value = txtEmpid.Text;
spcmd.Parameters.Add("sal", OracleType.Number, 5).Value = txtSal.Text;
spcmd.ExecuteNonQuery();
}

Similar Messages

  • Java passing too long String parameter to SQL

    Hi all, I'm having trouble with passing parameters to MS SQL. My application calls a stored proc from the SQL server that has 11 parameters, 9 of them are of type varchar. But it fails because the java virtual machine built a huge query that MS SQL can't handle. In fact each of the varchar parameters's length is 8000 , like @Designation = 'Branch Manager ' (a trailing of spaces that makes the parameter 8000 chars). I'm wondering if there is any configuration that stop this crazy thing from happening?

    Ok, I figured out a walk-around. I use stmt.setObject() instead of stmt.setString(), these will produce very different outputs (stmt is a callableStatement object). Code below:
    stmt = connection.preparecall("{call EmpInfo_Insert(?,?)}");
    stmt.setString(1,"name");
    stmt.setObject(2,"designation",java.sql.Types.VARCHAR);
    stmt.execute();The SQL profiler will show something like this:
    declare @P1 int
    set @P1=0
    declare @P2 int
    set @P2=4104
    declare @P3 int
    set @P3=8193
    declare @P4 int
    set @P4=0
    exec sp_cursoropen @P1 output, N' EXEC EmpInfo_Insert @P1,@P2', @P2 output, @P3 output, @P4 output, N'@P1 varchar(8000),@P2 varchar(8000)',
    'name          (you know, an additional of 7996 spaces)','designation'<---(this one don't have that issue)So the question left here would be is anyone out there encounter this problem or is it just me?

  • JNDI lookup from a Java stored proc?

    Anybody know if a JNDI lookup, or accessing an EJB from a Java stored procedure is possible? I looked through all the docs and it says it is possible but doesn't specify how. In the java class thats resolved through the stored proc, how are the server generated classes and interfaces made available? Normally setting the classpath for the client app that does the lookup accomplishes this, but what if its called through the stored proc?

    check the rdbms platform's "javavm" folder for a "readme.txt" file ...
    In section 3.16.9, it discusses how to do this ...

  • Call Developer 2000 Reports/Forms from PL/SQL stored proc.

    Hello all,
    I am searching for a method for a stored procedure on Oracle 8.0 to call a Oracle Developer 2000 Report or Form.
    Any suggestions,
    Thanks,
    Julian

    No offense,
    Do you mean calling a trigger in a Form or Report to fire off another of the same? Or do you mean how do I fire Forms from a Database stored procedure?
    Please I don't mean any offense, it is just hard, sometimes to say simple concepts and not sound, well, bad.
    Otherwise think about it. A Stored procedure is run inside the database, it has no idea where you client is, and doesn't know which type of client you have (X-Windows, Microsuck), and doesn't know how to fire off an app on the client.
    One concept that is hard, sometimes, to get is where things are run. Forms runs on an Apps Server (Java screens), or a client, like on a PC. Stored procedures run, usually, on a whole different box, a database server. The database server is not that well connected that it can fire off a app on a client. Try to go to a Unix database server and run a command to fire off Internet Explorer on your client!? Not real easy to do.

  • Executing a stored proc from inside a stored proc

    Hi,
    I'm trying to execute a stored procedure from inside another stored procedure, and I can't seem to work out the correct syntax to use, could someone please give me a pointer, it's starting to drive me insane :]
    CREATE OR REPLACE PROCEDURE foo (blah in type) AS
    BEGIN
    EXEC OTHER_STORED_PROC();
    END;
    Thank you kindly,
    Anthony...

    EXEC is a SQL*Plus command, not PL/SQL syntax. In SQL*Plus, EXEC <<procedure name>> is just shorthand for
    BEGIN
      <<procedure name>>
    END;Calling a stored procedure from another stored procedure (or any PL/SQL block), can bypass the extra begin/end pair because it's already inside a PL/SQL block. Thus, the syntax you need is just
    CREATE OR REPLACE PROCEDURE foo (bar IN type)
    AS
    BEGIN
      other_stored_procedure();
    END;Justin
    Distributed Database Consulting, Inc.
    www.ddbcinc.com/askDDBC

  • How pass VISA resource string from C++ as uintptr_t* to a LabVIEW generated DLL ?

    My coworker build a DLL from LabVIEW that I am trying to call from C++.
    void__cdeclMeasureDCvolts(uintptr_t*VISAResourceName, int32_tChannelNumber,LVBoolean*MonitorResult,double*MeasuredVoltage, TD1*errorOut);
    Does "extcode.h" define macros or functions for string conversions?  Or should I request my coworker rebuild the VI's to make arguments more C/C++ friendly?
    Thanks in advance for any tips or direction.  Examples are * much * appreciated.
    -Ed
    TestObjectMeasurement* testObjectMeasurement = m_measurementMap[name];
    TestObjectInstrument* testObjectInstrument = m_instrumentMap[selectedInstrumentName];
    int slot = 1;
    int bank = 1;
    int channel = 1;
    int channelNumber = 1000 * slot + channel;
    char * visaResourceName = testObjectInstrument->visaResourceName().toLatin1().data();
    LVBoolean monitorResult = LVBooleanFalse;
    double measuredVoltage = -1.0;
    TD1 errorOut = {0};
    try
    // void __cdecl MeasureDCvolts(uintptr_t *VISAResourceName,
    // int32_t ChannelNumber, LVBoolean *MonitorResult, double *MeasuredVoltage,
    // TD1 *errorOut);
    MeasureDCvolts(reinterpret_cast<uintptr_t*>(visaResourceName), channelNumber, &monitorResult, &measuredVoltage, &errorOut);
    catch(...)
    qDebug() << "Exception thrown by: MeasureDCvolts";
    QString errorSource = QString::fromUtf8(reinterpret_cast<const char*>(LHStrBuf(errorOut.source)), LHStrLen(errorOut.source));
    qDebug() << errorSource;
    LStrHandle errorTextHandle = {0};
    bool foundErrorText = NIGetOneErrorCode(errorOut.code, &errorTextHandle);
    if(foundErrorText)
    QString errorText = QString::fromUtf8(reinterpret_cast<const char*>(LHStrBuf(errorTextHandle)), LHStrLen(errorTextHandle));
    MessageHelper::messageError(errorText, errorSource);

    Why is it not a solution? It was exactly about what you wanted to do and the solution in the last post is how it can be made to work. There is NO way to ddirectly create a LabVIEW native VISA resource in C code that is not called from within LabVIEW, unless you consider hacking the LabVIEW system and using undocumented functions a solution. But that has very good chances of breaking with future LabVIEW versions.
    Your only other option is to export another function from the DLL that accepts a String and uses VISA Open to explicitedly open the VISA session in your LabVIEW DLL and returning that VISA session to your C code. This is functionally equivalent to passing a String to your current function but avoids the lookup and potential recreation of the VISA refnum on each call. Something I would only feel bothered if you intend to call this function many thousend times each second, which for VISA communication seems very unlikely.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Loading a long string from a CSV

    I'm loading data from a third party CSV file which contains a field which could be up to 8000 characters long. If I put varchar2(8000) into the model for the file I get error ORA-00910 as varchar2 can only be up to 4000 characters long.
    Is there a way of telling the ODI model for the file that the column is a CLOB field rather than varchar2(8000)?
    Ironically, it's a column I'm not actually loading into the target table!

    Hi,
    We do this thing every morning. The source datastore is a file with a string(8000) column. The target datastore is Oracle with CLOB column. The size has never been a problem.

  • Pass rich text string from webdynpro java into interactive form

    Hi, experts:
      I know rich text-related questions have been asked by many other forum member.
      But I still cannot figure out how to display rich text string in the interactive form.
      below code is set rich text string in my webdynpro program.
    wdContext.currentDataForPDFElement().setDescription("<html xmlns:xfa=\"http://www.xfa.org/schema/xfa-data/1.0/\" xfa:contentType=\"text/html\"><body><p>20100730 0950</p><h1><strong>test1</strong><br /></h1></body></html>");
    or
    wdContext.currentDataForPDFElement().setDescription("<p>20100730 0950</p><h1><strong>test1</strong><br /></h1>");
    Text field in the interactive form has been assign "Field Format" to "Rich Text", "Data Format" to "XHTML".
    I also check XML in the "XML source" tab of interactive form.
    <field name="Description" w="152.817mm" minH="25.2984mm" colSpan="3" access="readOnly">
      <ui>
      </ui>
      <font typeface="Myriad Pro"/>
      <bind match="dataRef" ref="$record.Description"/>
      <value>
         <exData contentType="text/html">
            <body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:APIVersion="2.4.5277.0"/>
         </exData>
      </value>
    </field>
    My development tool version is NWDS CE EHP1 SP4, LiveDesigner v 7.1.
    What I miss? Any hints would be very appreciated.

    What about these:
    Formatting in SO10 texts into the form
    Trouble with xhtml text in adobe forms
    Prevent HTML escaping in RichText fields
    regards Otto

  • How to call a remote stored proc from a local stored proc using DB Link

    Hi All,
    I am trying to call a stored procedure residing in another data base from the local procedure of my local data base using DB link,I am using the following syntax to call the procedure
    CREATE OR REPLACE PROCEDURE MYLOCALPROCEDURE(Input1 IN varchar2 ,Input2 IN varchar2) IS
    BEGIN
    RemoteStoredprocedurename(Input1,Input2)@DBLINK;
    END;
    END MYLOCALPROCEDURE;
    Its giving a compilation error as @ not expected
    If i try to execute this way
    CREATE OR REPLACE PROCEDURE MYLOCALPROCEDURE(Input1 IN varchar2 ,Input2 IN varchar2) IS
    BEGIN
    RemoteStoredprocedurename(Input1,Input2);
    END;
    END MYLOCALPROCEDURE;
    Its giving an error as stored procedure must be declared.
    A public synonym is created at the Remote database to which DB link is created.
    Can you please let me know on the exact syntax to call the procedure residing in other database through DB Link.
    Thanks in advance,
    Kumar

    Try:
    CREATE OR REPLACE PROCEDURE MYLOCALPROCEDURE(Input1 IN varchar2 ,Input2 IN varchar2) IS
    BEGIN
    RemoteStoredprocedurename@DBLINK(Input1,Input2);
    END;
    END MYLOCALPROCEDURE; Amiel

  • Return ref cursor from database link/stored proc? do-able?

    Is it possible to return a REF CURSOR from a stored procedure that is being called from a remote database via a database link???
    We are trying from Pro*Cobol on MVS (which has db link pointing to AIX thru db link) and get a 00993 error, which seems to say this is not possible.
    Before I give up, thought I would check with the experts....
    Thanks in advance.

    You can't return Java objects as stored procedure or query results.
    Douglas

  • Oracle SID from within a stored proc

    Sorry - probably a no-brainer, but can't find it anywhere in the doc. Can anyone tell me how to query the current session identifier in pl/sql. (ie. the SID I can use to find an entry in v$$session.
    Thanks,Tim

    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:114412348062

  • Passing long string to shell script from java

    I am trying to passa a long string to a shell process through java,
    call is like
    Runtime rtime = Runtime.getRuntime();
    String callAndArgs[] = {"/apps/jetty4/jstest/jstest.sh",jarCo,queue,text};
    Process child = rtime.exec(callAndArgs);
    here the string text is :
    |HEADER|JAR933|[email protected]|290001|OL0006528|WIN4015444|SHAFT_FORGING|1.0|Baan EDM|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
    |290001|WIN4015444|00||||2|SHAFT FORGING|9|AXELSMIDE|3|ACHSE SCHMIEDEST�CK|4|ARBRE FORG�|f|AKSELITAOS|||||||||||||||||||||||No||Approved|41.0|Mechanic|Yes|pc||WIN4015444|EL20|Purchased|Metric||0|20051120|||||Released||||||||||||||||No||||||||||||||||||||||||||||||||
    Now i use this string in shell script to pass as an argument to other class. But the string gets truncated.
    How do i solve this?

    It appears that your os is truncating the data - Java's not involved.
    Maybe write the data to a file and then read it into the external program some way.

  • Problem - reading an abitrary string from the command line in basic swing

    Hi,
    I'm sorry if this problem is a bit basic, but I've only just started swing in Java. Anyway, I'm trying to adapt a basic swing version of the HelloWorld class. When I try to pass an abitrary string from the command line to the label within the class, I get the following error,
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
            at week2.HelloWorldSwing_commandline.main(HelloWorldSwing_commandline.java:31)
    Java Result: 1I must be missing something because I can't see where the problem is in the following code.
    import javax.swing.*;
    import java.awt.*;
    public class HelloWorldSwing_commandline {
        String message;
        private static void createAndShowGui(String message){
            JFrame.setDefaultLookAndFeelDecorated(true);
            JFrame frame = new JFrame("HelloWorldSwing");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JLabel label = new JLabel(message);
            Container content = frame.getContentPane();
            content.add(label);
            frame.pack();
            frame.setVisible(true);
        public static void main(String[ ] args) {
         createAndShowGui(args[1]);
    }Any help would really be appreciated.

    Hi,
    I've tried changing the index value to O in the main method, but I still get the same error.
    I'm running this in NetBeans 4.1, and when I try to run the class I get the error as listed above.
    Any ideas how to correct this error?
    Thanks

  • How to generate a report in pdf from a stored proc

    Hi, i need guidance on how to generate a report in pdf from an oracle stored proc.
    The environment is oracle 10gas + 10gdb.
    On a specific event, a PL/SQL stored procedure is called to do some processing and at the end of the processing to generate report which has to be sent to the printer (and optionally previewed by the user).
    Can anyone assist me with this?

    Hi ,
    One 'simple' way is by using the DBMS_SCHEDULER db package and the procedure CREATE_JOB(....) using as job_type the value 'EXECUTABLE'...
    Read for further info in 'PL/SQL Packages and Types Reference'.
    If you have access to OEM ... you can configure this there using wizard.....
    Other way is to use the External Procedure call capabiblity of Oracle DB Server...:
    http://www.oracle.com/pls/db102/ranked?word=external+procedure+call&remark=federated_search
    My greetings,
    Sim

  • Creating a table/view or temporary table from within a stored procedure

    Hi Gurus,
    Can someone tell me if it is possible to create a table (or view) from within a stored procedure.
    PROBLEM:
    In fact I need to create a report at back end (without using oracle developer forms or reports). This report requires creating several tables to hold temporary report data. If I create a sql*plus script for this, i works fine, because it can run DDL and other sql or pl/sql statements sequencialy. But this sql*plus script cannot be called from application. So, application needs an stored procedure to do this task and then application call that procedure. But within stored procedure, i am unable to create table (or run any ddl statement). Can somebody help me in this?
    Thanks in Advance.

    Denis,
    The problem with Nicholas' suggestion isrelated to the fact that now you have two components
    (a table and a stored procedure)
    I don't see any problem to have "two
    components" here. After all, what about all others
    tabes ? This is only one more, but I don't understand
    why want manage less objects, that implies more code,
    more maintenance, and more difficulties to debug.
    Needless to say about performance...
    Nicolas.The same reasons apply if you were forced to declare all PL/SQL variables publicly (outside the stored proc.) rather than privately (from inside the stored proc). Naming conflicts for one. If the name that you want to use for the GTT already exists, you need to find a new name. With the SQL Server type local/private declarations, you wouldn't have that problem.
    I can see how performance would be the same or better using GTTs. If the number of records involved is low, this is likely negligable.

Maybe you are looking for