Split String to use in SQL

How do I split the string Bill Whatever Whatever Clinton into firstname "Bill" middlename "Whatever Whatever" and lastname "Clinton".
BR Badleif

StringTokenizer st=new StringTokenizer(strFName," ");
String [] strArr = new String[3];
for(int i=0;i<3;i++)
strArr[i] = st.nextToken();
}return strArr;
String strFName=strArr[0];
String strMNAme=strArr[1];
etc.........

Similar Messages

  • Problem in retreiving string 1020 using ms sql  in BODI sql query

    I am taking a column from ms sql using select statement in bodi like
    $temp=sql('ds_stage',select x from table A where X>1);
    print('[$temp]');
    it is printing the value upto 1020 characters of my data,after that it is not showing the remaining data.
    I tried printing the sql statement directly in print statement rather than assigning it to a variable,
    I tried casting teh value in select statemet like cast(x as text) or varchar and more.. nothing works..
    no change in the result.
    is that problem with BODI ? same query give full 1500 characters in ms sql but it doesnt come in BODI
    I do not understand the problem.
    Thanks

    I assume from your message that you are attempting to
    deploy your application into OC4J - you're probably
    implicitly using the inbuilt OC4J if your using JSPs.
    If so, try placing the jdbc jars into the <JDEVHOME>\lib directory
    and referencing them from the j2ee\home\application.xml
    file:
    use lines like:
    <library path="../../../lib/msbase.jar" />
    regards, Karl

  • Get first word in string containing '-' using T-SQL

    I'm trying to update a column in a table by inserting the first word (that has hyphen) in another column.  I'm trying this:
    UPDATE DSoil
    SET SoilName column = first word of MapUnit column (Only if the first word has '-' character).
    Appreciate any help.
    Marilyn Gambone

    DECLARE @myTable TABLE (MapUnit Varchar(100), SoilName Varchar(100) Null)
    INSERT INTO @myTable (MapUnit)
    VALUES ('Test'), ('test-1'), ('-abc test')
    UPDATE @myTable
    SET SoilName = (CASE WHEN CHARINDEX('-', MapUnit) <> 0 THEN SUBSTRING(MapUnit, 1, (CASE WHEN CHARINDEX(' ', MapUnit) = 0 THEN LEN(MapUnit) ELSE CHARINDEX(' ', MapUnit) END)) ELSE SoilName END)
    SELECT * FROM @myTable
    --output
    MapUnit SoilName
    "Test" NULL
    "test-1" test-1
    "-abc test" -abc
    Best Wishes, Arbi; Please vote if you find this posting was helpful or Mark it as answered.

  • Using a SQL Query in an Alert and Matching a String

    I've created an alert in 12.0.4 using a SQL Query and the field that I'm trying to match is a string.  Originally the query returned multiple rows but when the alert still didn't fire, I modified the query WHERE clause to return only one row:
    NAME                                RESPONSE
    Are area lights working?            No
    My expression in the metric is RESPONSE.  In the Monitor I'm matching a string equal to No.  (Do I need double quotes around the matchvalue?  Single quotes?  No quotes?)  The metric is in the 15min scan group, the role is xMII Developers and I'm in that role. The monitor alert string is ' =  '.  Both metric and monitor are active and I've subscribed to the monitor.  Other alerts in the 15min scan group (all based on tag queries) are firing off properly.
    Why is nothing showing up in the Alert Log?
    David Macindoe

    David,
    Did you figure out the answer?  If not, I will try to find someone to address your question.
    Mike

  • Footer navigation using pl/sql - substitution strings

    Hi
    I want to make a footer navigation (a BLAF like footer with the same captions and links that appear in the Tabs and the Navigation Bar) using a PL/SQL region. The code I want to use should work for any HTML DB application.
    The procedure could be defined like this:
    PROCEDURE prb_footer_navigation( p_application_id VARCHAR2
    , p_page_id VARCHAR2
    , p_session_id VARCHAR2);
    p_application_id will be used to get the caption and links of the specific application and p_page_id will be used to know which tab is selected.
    I'm using this query in the procedure:
    SELECT t.tab_text caption
    , t.tab_target link
    , t.tab_sequence num
    FROM flows_010600.wwv_flow_toplevel_tabs t
    WHERE t.flow_id = p_application_id
    ORDER BY t.tab_sequence
    (the user has been granted select from flows_010600.wwv_flow_toplevel_tabs)
    The problem is:
    tab_target has substitution strings like '&XXX.' or '&PX_XXX.', so how can I get the real link with resolved substitution strings using pl/sql?
    Something like function_resolve_string(p_string, p_session_id) would be appreciated...
    Thanks in advance!

    A.U.,
    Have you considered looking at how the navigation bar gets onto your page by examining the page template? You'll find something like this in the body section: 
      <table width="100%" cellpadding="0" cellspacing="0" border="0" summary="">
        <tr>
          <td valign="top" class="t1Logo">#LOGO#</td>
          <td align="right" valign="top">#NAVIGATION_BAR#</td>
        </tr>
      </table>Just copy and paste that onto the end of the body section, or into the footer section of the template, although the footer might not support all the same substitution patterns.
    If that's the kind of result you have in mind, do the same thing for the (html) tables that contain #PARENT_TAB_CELLS# and #TAB_CELLS#. I don't guarantee this will work, but it's worth experimenting with.
    Scott

  • How to use Native SQL String

    Hi all,
    How do i use Native SQL String in the Reciver JDBC Adapter.
    Do i need to change the message format could u suggest me some blogs on the same.
    Also please can anyone let me knw if i can use this for stored procedure.

    hi aditya,
    there shud be no format as such. for sql xml format there are specific structure. but for native sql there shudnt be any specific structure.
    as pointed in sap documentaion:
    Instead of an XML document format, a text is expected that represents any valid SQL statement.
    When inserting a line into a table the corresponding document looks as follows:
    INSERT INTO tableName  (column-name1, column-name2, column-name3) VALUES(‘column-value1’, ‘column-value2’, ‘column-value3’)
    so jus make sure that u give a valid sql statement becoz if will be passed as it is to the database and try ur scenario.
    regards,
    latika.

  • How to split the string by datetime in sql

    Hi,
    How to split the string by datetime in sql, I've a table with comments column stores comments by datetime, while selecting I want to split and show as in rows by each jobref.
    can anyone help me in this please.
    Thanks,

    declare @callcentre table (comments varchar(max),lbiref varchar(200))
    insert into @callcentre
    select '(28/10/2014 14:56:14) xyz ..... call  logged   (28/10/2014 14:56:58) xyz ..... call updated   (28/10/2014 14:57:41)xyz ..... call updated','Vi2910201'
    insert into @callcentre
    select '(29/10/2014 14:56:14) xyz ..... call  logged   (29/10/2014 14:56:58) xyz ..... call updated   (29/10/2014 14:57:41)xyz ..... call updated','Vi2910202'
    insert into @callcentre
    select '(30/10/2014 14:56:14) xyz ..... call  logged   (30/10/2014 14:56:58) xyz ..... call updated  
    output:
    1) 28/10/2014 14:56:14, (28/10/2014 14:56:14) xyz ..... call  logged ,'Vi2910201'
     2) 28/10/2014 14:56:58 ,(28/10/2014 14:56:58) xyz ..... call updated ,'Vi2910201'
    3) 28/10/2014 14:57:41,  (28/10/2014 14:57:41)xyz ..... call updated,'Vi2910201'
    4) 28/10/2014 14:56:14, (28/10/2014 14:56:14) xyz ..... call  logged ,'Vi2910202'
     5) 28/10/2014 14:56:58 ,(28/10/2014 14:56:58) xyz ..... call updated ,'Vi2910202'
    6) 28/10/2014 14:57:41,  (28/10/2014 14:57:41)xyz ..... call updated,'Vi2910202'
    7) 28/10/2014 14:56:14, (28/10/2014 14:56:14) xyz ..... call  logged ,'Vi2910203'
     8) 28/10/2014 14:56:58 ,(28/10/2014 14:56:58) xyz ..... call updated ,'Vi2910203'
    Thanks,
    See this illustration
    declare @callcentre table (comments varchar(max),lbiref varchar(200))
    insert into @callcentre
    select '(28/10/2014 14:56:14) xyz ..... call logged (28/10/2014 14:56:58) xyz ..... call updated (28/10/2014 14:57:41)xyz ..... call updated','Vi2910201'
    insert into @callcentre
    select '(29/10/2014 14:56:14) xyz ..... call logged (29/10/2014 14:56:58) xyz ..... call updated (29/10/2014 14:57:41)xyz ..... call updated','Vi2910202'
    insert into @callcentre
    select '(30/10/2014 14:56:14) xyz ..... call logged (30/10/2014 14:56:58) xyz ..... call updated','Vi2910203'
    SELECT LEFT(p.u.value('.[1]','varchar(max)'),CHARINDEX(')',p.u.value('.[1]','varchar(max)'))-1) AS [Date],
    '(' + p.u.value('.[1]','varchar(max)') AS comments,
    lbiref
    FROM
    SELECT lbiref,CAST('<Root>' + STUFF(REPLACE(comments,'(','</Data><Data>'),1,7,'') + '</Data></Root>' AS XML) AS x
    FROM @callcentre c
    )t
    CROSS APPLY x.nodes('/Root/Data')p(u)
    and the output
    Date comments lbiref
    28/10/2014 14:56:14 (28/10/2014 14:56:14) xyz ..... call logged Vi2910201
    28/10/2014 14:56:58 (28/10/2014 14:56:58) xyz ..... call updated Vi2910201
    28/10/2014 14:57:41 (28/10/2014 14:57:41)xyz ..... call updated Vi2910201
    29/10/2014 14:56:14 (29/10/2014 14:56:14) xyz ..... call logged Vi2910202
    29/10/2014 14:56:58 (29/10/2014 14:56:58) xyz ..... call updated Vi2910202
    29/10/2014 14:57:41 (29/10/2014 14:57:41)xyz ..... call updated Vi2910202
    30/10/2014 14:56:14 (30/10/2014 14:56:14) xyz ..... call logged Vi2910203
    30/10/2014 14:56:58 (30/10/2014 14:56:58) xyz ..... call updated Vi2910203
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Split one column value into two columns using t-sql

    Hi All,
    I have one varchar column in a table.
    Col1
    ABC-12C4
    BC-A345
    CD
    XYZ
    How to split this into two columns like this using t-sql
    Col1   Col2
    ABC    12C4
    BC      A345
    CD     
    XYZ
    Thanks,
    RH
    sql

    assuming a static delimiter, and the split will end up with a max of 2 columns, something like this would work.  basically you just need to determine where the delimiter is, and then use the left and right functions to find the 2 pieces.
    declare @t table(value varchar(10))
    insert into @t(value)
    values
    ('ABC-12C4'), ('BC-A345'), ('CD'), ('XYZ')
    select
    case
    when charindex('-', value) != 0 then left(value, charindex('-', value) - 1)
    else value
    end as col1,
    case
    when charindex('-', value) != 0 then right(value, len(value) - charindex('-', value))
    else ''
    end as col2
    from @t

  • Split string function in oracle ...

    Hello,
    Little question, is there any split string function available in Oracle.
    SQL> select more_info
    2 from dba_advisor_findings;
    MORE_INFO
    Allocated Space:4390912: Used Space:4237403: Reclaimable Space :153509:
    select more_info as Allocated_Space,
    more_info as Used_Space,
    more_info as Reclaimable_Space
    from dba_advisor_findings
    Allocated_Space Used_Space Reclaimable_Space
    4390912 4237403 153509
    Thanks,
    Manish Gupta

    I explored more on SUBSTR and INSTR string functions ... and below is the solution
    select substr(more_info,instr(more_info,':',1,1)+1,instr(more_info,':',1,2)-instr(more_info,':',1,1)-1) as "Allocated_Space",
    substr(more_info,instr(more_info,':',1,3)+1,instr(more_info,':',1,4)-instr(more_info,':',1,3)-1) as "Used_Space",
    substr(more_info,instr(more_info,':',1,5)+1,instr(more_info,':',1,6)-instr(more_info,':',1,5)-1) as "Reclaimable_Space"
    from dba_advisor_findings;
    Allocated_Space
    Used_Space
    Reclaimable_Space
    4390912
    4237403
    153509
    Thanks...

  • Split string into new column

    Hi All,
    Hoping you are able to help.
    I have a table of approx 16 items that I need to split,
    EG:
    CUSTOMER ACCEPTANCE - HAS BEEN DECLINED - DO NOT APPLY TO ACCOUNT
    CUSTOMER ACCEPTANCE -  HAS BEEN ACCEPTED - APPLY TO ACCOUNT
    CUSTOMER ACCEPTANCE - PENDING DECLINE - ESCALATION REQUIRED - RAISED IN PORTAL
    ESCALATION - RAISED - PENDING
    ESCALATION - NOT RAISED - STILL TO BE PROCESSED
    I need to Keep the first two sections, eg CUSTOMER ACCEPTANCE - HAS BEEN DECLINED in one column, and split off the remaining, eg DO NOT APPLY TO ACCOUNT into a new TEMP table to insert as a column into an existing table.
    With little SQL experience, I am having difficulties as they are all of different lengths / criteria etc. Some have 3 hyphens whilst others have 4+
    Is anyone able to help point me in the right direction with this request? I will be greatly appreciated.
    Kind Regards,
    BTMMP

    If you're trying to do this all in a SQL query or stored procedure, then you'll probably get better results on the SQL Server forums. However, if you're working with a PowerShell or VBScript that's doing the work, you're in the right place.
    Here's one example of how you could do what you're describing.  By the way, what do you want to do with the string "CUSTOMER ACCEPTANCE - PENDING DECLINE - ESCALATION REQUIRED - RAISED IN PORTAL"?  Should that be split into "CUSTOMER ACCEPTANCE
    - PENDING DECLINE" and "ESCALATION REQUIRED - RAISED IN PORTAL", or "CUSTOMER ACCEPTANCE - PENDING DECLINE - ESCALATION REQUIRED" and "RAISED IN PORTAL"?
    (In other words, should the script only split off whatever's after the final hyphen, or should it grab the first two pieces of text and split off everything else?)
    Here's an example in PowerShell which assumes that you want to separate out all text after the final hyphen in a string.  It uses a regular expression, though you could accomplish the same thing with Split, Join and Trim operations, if you prefer.
    $string = 'CUSTOMER ACCEPTANCE - HAS BEEN ACCEPTED - APPLY TO ACCOUNT'
    if ($string -match '(.*?)\s*-\s*([^-]*)$')
    $split = $matches[1], $matches[2]
    else
    $split = $string, ''
    Write-Host "Original String: $string"
    Write-Host "First Text : $($split[0])"
    Write-Host "Second Text : $($split[1])"

  • Error while calling java using pl/sql

    hi..
    i would like to load and call simple java into oracle database. this is my simple java code.
    public class SimpleJava {
    public void main(String[] args) {
    System.out.println("Here we are");
    then, i created .class file and ready to be loaded into oracle database using loadjava utility. i already loaded it successfully into a database. but, when i use pl/sql to call it in SQl*Plus, i got this error.... can anyone help me to solve this problem?
    SQL> create or replace procedure call_simplejava
    2 as language java
    3 name 'SimpleJava.showMessage()';
    4 /
    Procedure created.
    SQL> set serveroutput on;
    SQL> call dbms_java.set_output(50);
    Call completed.
    SQL> execute call_simplejava;
    java.lang.NoSuchMethodException: No applicable method found
    at
    oracle.aurora.util.JRIExtensions.getMaximallySpecificMethod(JRIExtensions.java:4
    33)
    at
    oracle.aurora.util.JRIExtensions.getMaximallySpecificMethod(JRIExtensions.java:4
    75)
    BEGIN call_simplejava; END;
    ERROR at line 1:
    ORA-29531: no method showMessage in class SimpleJava
    ORA-06512: at "GISDB.CALL_SIMPLEJAVA", line 1
    ORA-06512: at line 1

    Hi,
    public class SimpleJava {
    public void main(String[] args) {
    System.out.println("Here we are");
    then, i created .class file and ready to be loaded into oracle database using loadjava utility. i already loaded it successfully into a database. but, when i use pl/sql to call it in SQl*Plus, i got this error.... can anyone help me to solve this problem?Did you run the SimpleJava in your ED or on command prompt??
    I created the same class file but when I said
    java SimpleJava
    It threw the following error
    java.lang.NoSuchMethodException: No applicable method found
    So modify your code
    as
    public class SimpleJava {
       public static void main(String[] args) {
            System.out.println("Here we are");
       }Twinkle

  • How to find number of files in a folder using pl/sql

    please someone guide as to how to find number of files in a folder using pl/sql
    Regards

    The Java option works well.
    -- results table that will contain a file list result
    create global temporary table directory_list
            directory       varchar2(1000),
            filename        varchar2(1000)
    on commit preserve rows
    -- allowing public access to this temp table
    grant select, update, insert, delete on directory_list to public;
    create or replace public synonym directory_list for directory_list;
    -- creating the java proc that does the file listing
    create or replace and compile java source named "ListFiles" as
    import java.io.*;
    import java.sql.*;
    public class ListFiles
            public static void getList(String directory, String filter)
            throws SQLException
                    File path = new File( directory );
                    final String ExpressionFilter =  filter;
                    FilenameFilter fileFilter = new FilenameFilter() {
                            public boolean accept(File dir, String name) {
                                    if(name.equalsIgnoreCase(ExpressionFilter))
                                            return true;
                                    if(name.matches("." + ExpressionFilter))
                                            return true;
                                    return false;
                    String[] list = path.list(fileFilter);
                    String element;
                    for(int i = 0; i < list.length; i++)
                            element = list;
    #sql {
    insert
    into directory_list
    ( directory, filename )
    values
    ( :directory, :element )
    -- creating the PL/SQL wrapper for the java proc
    create or replace procedure ListFiles( cDirectory in varchar2, cFilter in varchar2 )
    as language java
    name 'ListFiles.getList( java.lang.String, java.lang.String )';
    -- punching a hole in the Java VM that allows access to the server's file
    -- systems from inside the Oracle JVM (these also allows executing command
    -- line and external programs)
    -- NOTE: this hole MUST be secured using proper Oracle security (e.g. AUTHID
    -- DEFINER PL/SQL code that is trusted)
    declare
    SCHEMA varchar2(30) := USER;
    begin
    dbms_java.grant_permission(
    SCHEMA,
    'SYS:java.io.FilePermission',
    '<<ALL FILES>>',
    'execute, read, write, delete'
    dbms_java.grant_permission(
    SCHEMA,
    'SYS:java.lang.RuntimePermission',
    'writeFileDescriptor',
    dbms_java.grant_permission(
    SCHEMA,
    'SYS:java.lang.RuntimePermission',
    'readFileDescriptor',
    commit;
    end;
    To use:
    SQL> exec ListFiles('/tmp', '*.log' );
    PL/SQL procedure successfully completed.
    SQL> select * from directory_list;
    DIRECTORY FILENAME
    /tmp X11_newfonts.log
    /tmp ipv6agt.crashlog
    /tmp dtappint.log
    /tmp Core.sd-log
    /tmp core_intg.sd-log
    /tmp da.sd-log
    /tmp dhcpclient.log
    /tmp oracle8.sd-log
    /tmp cc.sd-log
    /tmp oms.log
    /tmp OmniBack.sd-log
    /tmp DPISInstall.sd-log
    12 rows selected.
    SQL>

  • Problem using a SQL database Catalogue to insert data to a table

    I am developing with Version:
    10.3.1.0, Build: #99765....
    as part of a step in my process I need to store some data in an audit table.
    I have setup the SQL Catalogue entry and then use the following code:
    sentMail is defined as a local variable
    sentMail = RSPCA.Resources.RSPCA.R_SENTEMAIL()
    sentMail.sentemailBody = sendInternalRequest.htmlbody
    sentMail.sentemailDatesent = Fuego.Lang.Time
    sentMail.sentemailSubject = subject
    sentMail.sentemailTo = creation.participant.email
    sentMail.sentemailType = "People"
    store sentMail
    This works if I comment out this line:
    sentMail.sentemailBody = sendInternalRequest.htmlbody
    The issue I'm having maybe something to do with the size of the data, in oracle the field is a varchar2(4000) and it looks like the catalogue treats it as a String(4000), if I make sure I only put around 1500 characters in the field it works, but as soon as I put all in from my test data (about 2300) it fails with this message:
    The method 'CIL_sendToHQ' from class 'EstablishmentManagement.EMMaintainPeopleProcess.Default_1_0.Instance' could not be successfully executed.
    Caused by: [BEA][Oracle JDBC Driver][Oracle]ORA-01461: can bind a LONG value only for insert into a LONG column
    Caused by: [BEA][Oracle JDBC Driver][Oracle]ORA-01461: can bind a LONG value only for insert into a LONG column
    fuego.lang.ComponentExecutionException: The method 'CIL_sendToHQ' from class 'EstablishmentManagement.EMMaintainPeopleProcess.Default_1_0.Instance' could not be successfully executed.
         at fuego.component.ExecutionThreadContext.invokeMethod(ExecutionThreadContext.java:519)
         at fuego.component.ExecutionThreadContext.invokeMethod(ExecutionThreadContext.java:273)
         at fuego.fengine.FEEngineExecutionContext.invokeMethodAsCil(FEEngineExecutionContext.java:219)
         at fuego.server.execution.EngineExecutionContext.runCil(EngineExecutionContext.java:1278)
         at fuego.server.execution.microactivity.ComponentExecutionMicroActivity.runCil(ComponentExecutionMicroActivity.java:126)
         at fuego.server.execution.microactivity.ComponentExecutionMicroActivity.execute(ComponentExecutionMicroActivity.java:84)
         at fuego.server.execution.microactivity.MicroActivityEngineExecutionHandler.executeActivity(MicroActivityEngineExecutionHandler.java:57)
         at fuego.server.execution.ImmediateActivity.execute(ImmediateActivity.java:42)
         at fuego.server.execution.DefaultEngineExecution$AtomicExecutionTA.runTransaction(DefaultEngineExecution.java:304)
         at fuego.transaction.TransactionAction.startBaseTransaction(TransactionAction.java:470)
         at fuego.transaction.TransactionAction.startTransaction(TransactionAction.java:551)
         at fuego.transaction.TransactionAction.start(TransactionAction.java:212)
         at fuego.server.execution.DefaultEngineExecution.executeImmediate(DefaultEngineExecution.java:123)
         at fuego.server.execution.DefaultEngineExecution.executeAutomaticWork(DefaultEngineExecution.java:62)
         at fuego.server.execution.EngineExecution.executeAutomaticWork(EngineExecution.java:42)
         at fuego.server.execution.ToDoItem.executeAutomaticWork(ToDoItem.java:251)
         at fuego.server.execution.ToDoItem.run(ToDoItem.java:536)
         at fuego.component.ExecutionThread.processMessage(ExecutionThread.java:775)
         at fuego.component.ExecutionThread.processBatch(ExecutionThread.java:755)
         at fuego.component.ExecutionThread.doProcessBatch(ExecutionThread.java:142)
         at fuego.component.ExecutionThread.doProcessBatch(ExecutionThread.java:134)
         at fuego.fengine.ToDoQueueThread$PrincipalWrapper.processBatch(ToDoQueueThread.java:450)
         at fuego.component.ExecutionThread.work(ExecutionThread.java:839)
         at fuego.component.ExecutionThread.run(ExecutionThread.java:408)
    Caused by: fuego.components.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-01461: can bind a LONG value only for insert into a LONG column
         at fuego.sql.TableSQLObject.implicitStore(TableSQLObject.java:409)
         at fuego.sql.TableSQLObject.store(TableSQLObject.java:340)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at fuego.lang.JavaClass.invokeMethod(JavaClass.java:1410)
         at fuego.sql.SQLObject.invoke(SQLObject.java:364)
         at fuego.lang.Invokeable.invokeImpl(Invokeable.java:234)
         at fuego.lang.Invokeable.invokeDynamic(Invokeable.java:188)
         at EstablishmentManagement.EMMaintainPeopleProcess.Default_1_0.Instance.CIL_sendToHQ(Instance.xcdl:100)
         at EstablishmentManagement.EMMaintainPeopleProcess.Default_1_0.Instance.CIL_sendToHQ(Instance.xcdl)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at fuego.component.ExecutionThreadContext.invokeMethod(ExecutionThreadContext.java:512)
         ... 23 more
    Caused by: java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-01461: can bind a LONG value only for insert into a LONG column
         at albpm.jdbc.base.BaseExceptions.createException(Unknown Source)
         at albpm.jdbc.base.BaseExceptions.getException(Unknown Source)
         at albpm.jdbc.oracle.OracleImplStatement.execute(Unknown Source)
         at albpm.jdbc.base.BaseStatement.commonExecute(Unknown Source)
         at albpm.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
         at albpm.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
         at fuego.jdbc.FaultTolerantPreparedStatement.executeUpdate(FaultTolerantPreparedStatement.java:623)
         at fuego.sql.TableSQLObject.insert(TableSQLObject.java:626)
         at fuego.sql.TableSQLObject.implicitStore(TableSQLObject.java:391)
         ... 39 more
    Edited by: user10778731 on 21-Jan-2010 06:17

    Suspect you're not going to like this answer, but I never use the store() method for a database heir object anymore.
    The store() database method has been broken and then fixed and then broken again on too many release cycles to trust that it will work consistently as MPs/Hotfixes are applied. I'd suspect that your "String(4000)" problem might also be related to using the store() method.
    Others will probably disagree, but only use the OOTB PBL (JDBC) SQL or Dynamic SQL in the PBL logic. In your case, I think you might be best served by using Dynamic SQL. With Dynamic SQL you don't run into the shortcomings of JDBC SQL (String(4000) might be one of them) and you can then test / debug your SQL in your favorite DB tool of choice first (e.g. Toad, Squirrel, Sql Plus). Once successfully tested, you can then paste it back into your PBL.
    Dan

  • HELP URGENT:; Splitting strings in servlets

    hi ...
    I am trying to access the below servlet from another servlet in iplanet . I have to access a file and arrange the '|' delimited data in the file in a table format like in html ...
    I have used my own function inside the servlets which splits a string based on character ...But I always get
    Internal error: exception thrown from the servlet service function (uri=/servlet/ReportsDataServlet): java.lang.NullPointerException, Stack: java.lang.NullPointerException
    at ReportsDataServlet.split(ReportsDataServlet.java:82)
    at ReportsDataServlet.doPost(ReportsDataServlet.java:56)
    at ReportsDataServlet.doGet(ReportsDataServlet.java:14)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:919)
    at com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:483)
    The sample code is shown below....I get the same error when i tries with stringokenizer as well....Pls help me fix this.....
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, Se
    rvletException
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    cont=getServletContext();
    out.println("<html><head><title>Reports Data</title></head><body bgcolor=DBD0E2>");
    String repType = request.getParameter("Rep");
    String mon = request.getParameter("month");
    String day = request.getParameter("day");
    String year = request.getParameter("year");
    String repName = repType+"."+mon+"-"+day+"-"+year+".txt";
    BufferedReader in = new BufferedReader( new FileReader("/home/lnayar/baais/xmlServlet/"+rep
    Name));
    String st;
    st = in.readLine();
    cont.log(st);
    int c =0;
    out.println("<table border=\"3\" cellpadding=\"0\" cellspacing=\"0\" width=\"800\"><tr><td>L
    ATA</td><td>WC CLLI</td><td>WC NAME</td><td>ADSL_LOCATION</td><td>ATM FLAG</td><td>ATM RELIEF DATE</td><t
    d>FRAME FLAG</td><td>FRAME RELIEF DATE</td><td>GOLD FLAG</td><td>GOLD RELIEF DATE</td><td>OVERLAY INDICAT
    OR</td><td>COUNT</td></tr>");
    while (st != null)
    c++;
    st = in.readLine();
    StringTokenizer stt = new StringTokenizer(st);
    out.println("<tr>");
    while (stt.hasMoreTokens())
    //out.println("<td>"+stt.nextToken("|")+"</td>");
    out.println("<td>hello</td>");
    out.println("</tr>");
    while (st != null)
    c++;
    st = in.readLine();
    out.println("<tr>");
    Enumeration en = split(st,"|");
    while(en.hasMoreElements())
    out.println("<td>"+en.nextElement()+"</td>");
    out.println("</tr>");
    cont.log("out while");
    out.println("</table>");
    out.println("</body></html>");
    public Enumeration split (String str, String delim)
    Vector v = new Vector();
    int pos_1;
    int pos_2;
    //Set initial delimiter positions...
    pos_1 = 0;
    pos_2 = 0;
    //Start chopping off bits from the string
    //until left boundary reaches the length of string
    while ( pos_1 <= str.length() )
    pos_2 = str.indexOf(delim, pos_1);
    if ( pos_2 < 0 )
    pos_2 = str.length();
    String sub = str.substring (pos_1, pos_2);
    pos_1 = pos_2 + 1;
    v.addElement(sub);
    return v.elements();
    d deeply appreciate if soeone could take a look at the code and tell me exactly where i am going wrong ..... Its URGENT ...
    Thx
    klv

    But there is the while statement which filters null
    values..Which is useless in your case, because you proceed to change the value of st to something else which you don't check for null.
    At any rate, what you have to do is this:
    1. Look at the stack trace to find the line number where the error occurs.
    2. Look at that line in your code.
    3. Look at each object variable in that line. Find out how it became null and fix that.

  • Getting error while using DYNAMIC SQL

    Hi Team,
    I am Oracle DBA. I have limited knowledge on PL/SQL. I used below PL/SQL code to drop 50 partitons from one of the table.
    I used Dynamic SQL EXECUTE IMMEDIATE to drop partions. But error occured. If I commented EXECUTE IMMEDIATE, procedure executed successfully.
    Please suggest me, where i did the mistake. Also please suggest for better code than my code. please find below code and error details.
    SQL> ed
    Wrote file afiedt.buf
    1 DECLARE
    2 CURSOR DROP_PARTITON IS select partition_name from user_tab_subpartitions where PARTITION_NAME<='ABCD_2011_04';
    3 BEGIN
    4 for curr IN DROP_PARTITON LOOP
    5 DBMS_output.put_line(curr.partition_name);
    6 execute immediate(Alter table Table_Name drop partition curr.partition_name);
    7 end loop;
    8* END;
    SQL> /
    execute immediate(Alter table BILLCHRG drop partition curr.partition_name);
    ERROR at line 6:
    ORA-06550: line 6, column 19:
    PLS-00103: Encountered the symbol "ALTER" when expecting one of the following:
    ( - + case mod new not null others <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance
    execute forall merge time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string> pipe
    <an alternatively-quoted string literal with character set specification>
    <an alternative
    SQL> ed
    Wrote file afiedt.buf
    1 DECLARE
    2 CURSOR DROP_PARTITON IS select partition_name from user_tab_subpartitions where PARTITION_NAME<='ABCD_2011_04';
    3 BEGIN
    4 for curr IN DROP_PARTITON LOOP
    5 DBMS_output.put_line(curr.partition_name);
    6 --execute immediate(Alter table TABLE_NAME drop partition curr.partition_name);
    7 end loop;
    8* END;
    SQL> /
    ABCD_2009_06
    ABCD_2009_06
    ABCD_2009_06
    BILLCHRG_2011_04
    PL/SQL procedure successfully completed.

    PL/SQL code runs on the server, inside an Oracle process - thus PL/SQL code cannot dynamically write and display messages to the client. That server process is not connected to any keyboard, mouse or display.
    DBMS_OUTPUT can be used. This is a PL/SQL buffer area in that server process that code can write lines of text too. When the server process informs the client that it has completed, the client can now request the contents of the DBMS_OUTPUT buffer and the client can display it on the client device.
    This is what set serveroutput on in SQL*Plus does - tell the sqlplus client to request the DBMS_OUTPUT buffer after each Oracle server call made and to display the contents locally.
    So to display the SQL command can be done using DBMS_OUTPUT. E.g.
    declare
      dropPart varchar2(32767);
    begin
      for c in (select...) loop
        dropPart := 'alter table my_tab drop partition '||c.partition_name';
        --// write the SQL command to DBMS_OUTPUT
        DBMS_OUTPUT.put_line( dropPart );
        --// execute the SQL using a begin..end block in order to catch error
        begin
          execute immediate dropPart;
          DBMS_OUTPUT.put_line( 'command completed successfully' );
        exception when OTHERS then
          DBMS_OUTPUT.put_line( 'command failed with: '||SQLERRM(SQLCODE) );
        end;
      end loop;
    end;So after this code block has been executed and partitions dropped, sqlplus will display the DBMS_OUTPUT generated by this code block.

Maybe you are looking for

  • OfficeJet 4500 will not print two sided over network

    I'm running on Windows 7 with an OfficeJet 4500 G510n-z over WiFi.  Printer works great except that it will not print two sided.  We've used a non-WiFi 4500 to print two sided before.  With the new printer the first pages print and the pop-up shows o

  • Read from .csv file at startup

    Hi, I am making my first app and I need to read data from a csv file into a list. I first created this functionality on a console application, but now when I try to use the same code it does not work. class FoodDataBase { private List<Food> foodDataB

  • Wireless keyboard paired will not function ?

    Wireless keyboard paired with my iPad suddenly will not function - anyone help?

  • PI 7.1 How to delete  Messages Holding in RWB

    Hi Team, Its regarding messages with  HOLDING status in RWB. I have seen blogs how to process EOIO messages. But in my case , I have more than 10000 messages in HOLDING status . Though it is DEV box i dont want to process all those messages, which be

  • Oracle Developer Suite 11g support 64bit development?

    Is Oracle Developer Suite 11g going to support 64bit development? I have read the Statement of Direction and do not see any mention of supporting 64bit development. I can only find that the Oracle Database 11g will have a 64bit edition/version. jeema