Exception of pinter null in createCallableStatement

Hi all
Can you give me idea how can we solve exception of Null pointer to createCallableStatement like the code below.

Exaplanation:

I try to call the procedure of database backup class java bean by a listener to press single button action.
He worked this other statement and works very well in doDML (operation int, e TransactionEvent). But whan I want to play createCallableStatement manually, it shows "Null pinter exception! Please help me.
     try{       
        st=getDBTransaction().createCallableStatement(stmt,0);
     }
     catch(Exception e){
       System.out.println(e.toString());
       }
Please please give an idea what I have to do in this situation, I can't guss maybe it happens for the criteria of the connection.



Here are all the source
Backing Bean / java class
public class assmst extends EntityImpl {
  public assmst() {
  }
  private BindingContainer bindings;
  public static int VARCHAR2 = Types.VARCHAR;
  
  
  public BindingContainer getBindings() {
    if (this.bindings == null) {
      FacesContext fc = FacesContext.getCurrentInstance();
      this.bindings =
          (BindingContainer)fc.getApplication().evaluateExpressionGet(fc,
                                                                      "#{bindings}",
                                                                      BindingContainer.class);
    }
    return this.bindings;
  }



  public void metDepShedProcess(javax.faces.event.ActionEvent actionEvent) {
    // Add event code here...

    AttributeBinding DepAssetLifeBinding =
      (AttributeBinding)getBindings().getControlBinding("AssetLife");
    Number vAssetLife = (Number)DepAssetLifeBinding.getInputValue();    
    
    AttributeBinding NetCostBinding =
      (AttributeBinding)getBindings().getControlBinding("NetCost");
    Number vNetCost = (Number)NetCostBinding.getInputValue();    


    AttributeBinding SalvageAmtBinding =
      (AttributeBinding)getBindings().getControlBinding("SalvageAmt");
    Number vSalvageAmt = (Number)SalvageAmtBinding.getInputValue();    

    AttributeBinding DepStartDateBinding =
      (AttributeBinding)getBindings().getControlBinding("DepStartDate");
    Date vDepStartDate = (Date)DepStartDateBinding.getInputValue();    

    AttributeBinding LastDepValBinding =
      (AttributeBinding)getBindings().getControlBinding("LastDepVal");
    Number vLastDepVal = (Number)LastDepValBinding.getInputValue();    
    
    AttributeBinding AssetNoBinding =
      (AttributeBinding)getBindings().getControlBinding("AssetNo");
    String vAssetNo = (String)AssetNoBinding.getInputValue();    
    
    AttributeBinding DepPercentageBinding =
      (AttributeBinding)getBindings().getControlBinding("DepPercentage");
    Number vDepPercentage = (Number)DepPercentageBinding.getInputValue();    
      
    
 
    String stmt = "begin p_depschedule (?,?,?,?,?,?,?,?,?,?); end;"; 
    
     CallableStatement st=null;
     
     try{       
       System.out.println(getDBTransaction().isConnected());       
        st=getDBTransaction().createCallableStatement(stmt,0);
     }
     catch(Exception e){
       System.out.println(e.toString());
       }
     
    try{  
     
      
      //register the out parameter
      // st.registerOutParameter(5,VARCHAR2);
      
      //set the IN parameter value
      st.setObject(1,vAssetLife);
      st.setObject(2,vNetCost);
      st.setObject(3,vSalvageAmt);
      st.setObject(4,vDepPercentage); 
      st.setObject(5,"S"); //vDepMethod
      st.setObject(6,vDepStartDate); 
      st.setObject(7,vAssetNo); 
      st.setObject(8,"Q"); //vDepPeriod
      st.setObject(9,""); 
      st.setObject(10,"1"); 
      
       }catch(Exception e){      
      System.out.println(e.toString());return;
      }      
      //set company no which should be rmoved by assigned global/public variable
      
    try{
      //Execute that statement
      st.executeUpdate();
        
      //  System.out.println("Sucess.");
        
      ClsConfirmBean objmsgbox=new ClsConfirmBean();
      objmsgbox.addFacesInformationMessage("Process completed Successfully!!");
    }catch(Exception e){ 
        System.out.println("--------------------------.");
      } 
   
  }
Action listener
<af:commandButton text="Process!"
  partialSubmit="true"
    actionListener="#{Beanassmst.metDepShedProcess}"/>
Thank you.
Zed
====

Published by: Zakir Hossain on April 24, 2009 20:22

Zed,

Write a custom method in your Application Module Java application class. Good reading of the Guide to the developer of the Fusion to see how to do this - method, would you be able to call getDBTransaction().

You could then drag - move the method you just write data control palette to your page and drop it in the form of button. Then, when you click the button, your AM method would be called.

It is in any case the general essential.

A few rules to remember (based on the principle of the separation of concerns of MVC):

(1) database code belongs to the model layer, never in the view layer.
(2) never EntityImpl of access outside the model layer.
(3) do not in the view layer classes extend classes BC (as you did in your example).
(4) do not refer to the layer of the view of your model layer.

Best,

John

Tags: Java

Similar Questions

  • exception Java.lang.null pointer

    Hi all

    Enter iStore administrator-->--> Products--> option inventry catlog. error comes like this

    java.lang.NullPointerException
    java.lang.NullPointerException in Java.Math.BigDecimal. (BigDecimal.java:647) at oracle.apps.ams.webbean.CueCardContextWebBean.retrieveData(CueCardContextWebBean.java:298) at oracle.apps.asf.webbean.WebBeanHandler.retrieveData(WebBeanHandler.java:310) at amsProdInvOpMain. jspService(_amsProdInvOpMain.java:1628) to com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59) to oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:379) to oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594) to oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518) to javax.servlet.http.HttpServlet.service(HttpServlet.java:856) to com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64) to oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26) to com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15) to oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318) to com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621) to com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370) to com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871) to com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453) to com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313) to com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199) to oracle.oc4j.network.ServerSocketReadHandler$ SafeRunnable.run (ServerSocketReadHandler.java:260) to com.evermind.util.ReleasableResourcePooledExecutor$ (ReleasableResourcePooledExecutor.java:303) MyWorker.run at java.lang.Thread.run(Thread.java:619)

    Thank you

    Solution restart Apache or reboot the server App Server & DB

    Udomluk

  • Exception of Java null in the execution interface pointer

    I am using MS Access as a table source. I am populating these data in the target oracle table. When I run the interface, I get the following error the LKM.
    java.lang.NullPointerException
    at sun.jdbc.odbc.JdbcOdbcDriver.initialize(JdbcOdbcDriver.java:436)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:153)
    at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:409)
    at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:385)
    at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:352)
    at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:331)
    to oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter$ ConnectionProcessor.run (LoginTimeoutDatasourceAdapter.java:217)
    to java.util.concurrent.Executors$ RunnableAdapter.call (Executors.java:441)
    to java.util.concurrent.FutureTask$ Sync.innerRun (FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    to java.util.concurrent.ThreadPoolExecutor$ Worker.runTask (ThreadPoolExecutor.java:886)
    to java.util.concurrent.ThreadPoolExecutor$ Worker.run (ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)

    I appreciate any help in how to solve...

    Exactly what I was trying to express above. Did you solve it? Some firewall ports may need to be opened on two sides.

  • Persistent object Null pointer exception

    Hi all! This is my first time that you try to use persisted data and, as a result of the Bberry tutorial, I'm a JVM 104 "NullPointer Exception" when you try to synchronize and "setContents' in a new Bank persistence (so basically my"PersistentObject"is Null (as confirmed by the debug), which I suppose that logic since I have not stored all the data it again.) I guess I'm just curious as to why I get this error (and cannot just write something on the value "null"). Here is a code...

    public static PersistentObject levels = PersistentStore.getPersistentObject (0x3e1f605d47578703L);

    ...

    String [] level_info = {'0', '1'}; just to test

    Synchronized (levels) {//this is where I get the error of debugging of "NullPoint Exception", where levels = "null"

    levels.setContents (level_info);
    Levels.Commit ();

    }

    Thank you in advance for your help!

    I solved the problem by displaying the 4.6 JDE 'samples' tutorial persistentstoredemo...

    You can find it here on your PC:

    C:\Program search in Motion\BlackBerry JDE 4.6.0\samples\com\rim\samples\device\persistentstoredemo

    Thank you

    -Jordan

  • Exception of null pointer in sending email to a user.

    Hello

    I get this error when trying to send an E-mail when a user gets registered for the first time.

    12:08:34, 289 DEBUG INFO [ProfileFormHandler] createUser: user created; Item = user: 4040002

    12:08:34, 290 setRepositoryId (4040002) DEBUG INFO [ProfileFormHandler]

    12:08:34, 290 INFO [ProfileFormHandler] DEBUG affecting Profile.dataSource user: 4040002

    12:08:34, 294 DEBUG INFO [ProfileFormHandler] adding uncontrolled form exception: java.lang.NullPointerException

    12:08:34, 294 DEBUG INFO [ProfileFormHandler] origin of exception (if any): null

    12:08:34, ERROR 294 [[jsp]] Servlet.service () for servlet jsp threw exception

    java.lang.NullPointerException

    at atg.userprofiling.ProfileTools.sendEmailToUser(ProfileTools.java:2782)

    at Customer.CustomerProfileFormHandler.postCreateUser (CustomerProfileFormHandler.java:84)

    at atg.userprofiling.ProfileForm.handleCreate(ProfileForm.java:1115)

    at atg.userprofiling.ProfileFormHandler.handleCreate(ProfileFormHandler.java:380)

    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

    at java.lang.reflect.Method.invoke(Method.java:597)

    at atg.droplet.EventSender.sendEvent(EventSender.java:582)

    at atg.droplet.FormTag.doSendEvents(FormTag.java:800)

    at atg.droplet.FormTag.sendEvents(FormTag.java:649)

    at atg.droplet.DropletEventServlet.sendEvents(DropletEventServlet.java:523)

    at atg.droplet.DropletEventServlet.service(DropletEventServlet.java:550)

    at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)

    at atg.commerce.order.CommerceCommandServlet.service(CommerceCommandServlet.java:128)

    at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)

    at atg.commerce.promotion.PromotionServlet.service(PromotionServlet.java:191)

    at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)

    at atg.userprofiling.AccessControlServlet.service(AccessControlServlet.java:655)

    at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)

    at atg.servlet.sessionsaver.SessionSaverServlet.service(SessionSaverServlet.java:2425)

    at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)

    at atg.userprofiling.PageEventTriggerPipelineServlet.service(PageEventTriggerPipelineServlet.java:169)

    at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)

    at atg.multisite.SiteSessionEventTriggerPipelineServlet.service(SiteSessionEventTriggerPipelineServlet.java:139)

    at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)

    at atg.userprofiling.SessionEventTrigger.service(SessionEventTrigger.java:477)

    at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)

    at atg.userprofiling.ProfilePropertyServlet.service(ProfilePropertyServlet.java:208)

    at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)

    at atg.userprofiling.ProfileRequestServlet.service(ProfileRequestServlet.java:437)

    at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)

    at atg.servlet.pipeline.DynamoPipelineServlet.service(DynamoPipelineServlet.java:469)

    at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)

    at atg.servlet.pipeline.URLArgumentPipelineServlet.service(URLArgumentPipelineServlet.java:280)

    at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)

    at atg.servlet.pipeline.PathAuthenticationPipelineServlet.service(PathAuthenticationPipelineServlet.java:370)

    at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)

    at atg.userprofiling.sso.PassportServlet.service(PassportServlet.java:554)

    at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)

    at atg.servlet.security.ThreadUserBinderServlet.service(ThreadUserBinderServlet.java:91)

    at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)

    at atg.dtm.TransactionPipelineServlet.service(TransactionPipelineServlet.java:212)

    at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)

    at atg.multisite.SiteContextPipelineServlet.service(SiteContextPipelineServlet.java:348)

    at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)

    at atg.servlet.pipeline.HeadPipelineServlet.passRequest(HeadPipelineServlet.java:1174)

    at atg.servlet.pipeline.HeadPipelineServlet.service(HeadPipelineServlet.java:857)

    at atg.servlet.pipeline.PipelineableServletImpl.service(PipelineableServletImpl.java:250)

    at atg.filter.dspjsp.PageFilter.doFilter(PageFilter.java:263)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)

    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)

    at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)

    at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)

    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)

    at org.apache.coyote.http11.Http11Protocol$ Http11ConnectionHandler.process (Http11Protocol.java:598)

    to org.apache.tomcat.util.net.JIoEndpoint$ Worker.run (JIoEndpoint.java:447)

    at java.lang.Thread.run(Thread.java:662)

    My CustomerProfileFormHandler extends ProfileFormHandler of like: -.

    SerializableAttribute public class CustomerProfileFormHandler extends ProfileFormHandler {}

    Private TemplateEmailInfoImpl templateEmailInfoImpl;

    Private TemplateEmailSender templateEmailSender;

    Setters and Getters for above variables

    protected void postCreateUser (request, response DynamoHttpServletResponse DynamoHttpServletRequest)

    {

    Map params = new HashMap();

    params.put ("testParam", "testValue");

    try {}

    getProfileTools () .sendEmailToUser ((MutableRepositoryItem) getProfileItem (), false, false, getTemplateEmailSender (), getTemplateEmailInfoImpl (), params);     -> //Getting null Pointer Exception

    } catch (TemplateEmailException ex) {}

    System.out.println ("ERROR:-" + ex.toString ());

    If (isLoggingError ())

    logError (ex);

    }

    Help, please...

    My first observation is that instead use the TemplateEmailInfoImpl class, it is preferable to use the declaration as a class TemaplteEmailInfo and corresponding getter/Setter of implementing concrete.

    Ensure that you have a properly initialized in your CustomProfileFormHandler TemplateInfo object. In the file properties formhandler make sure templateEmailInfo points to DefaultTemplateEmailInfo or your custom instance of DefaultTemplateEmailInfo as:

    templateEmailInfo = / atg, userprofiling, email, DefaultTemplateEmailInfo

    or

    templateEmailInfo = / atg, userprofiling, email, MyTemplateEmailInfo

    MyTemplateEmailInfo.properties can have your configurations customized for DefaultTemplateEmailInfo properties:

    $class=atg.userprofiling.email.TemplateEmailInfoImpl
    
    # Default mailing name for Emails
    mailingName=My Website Mailing
    
    # Default Subject field
    messageSubject^=/atg/dynamo/service/SMTPEmail.defaultSubject
    
    # Default From and other fields
    messageFrom^=/atg/dynamo/service/SMTPEmail.defaultFrom
    #messageCc^=/atg/dynamo/service/SMTPEmail.defaultCc
    #messageBcc^=/atg/dynamo/service/SMTPEmail.defaultBcc
    
    # MessageContentProcessor responsible for processing the content
    contentProcessor=/atg/userprofiling/email/HtmlContentProcessor
    
    # The rest of the fields will be specified in the template
    fillFromTemplate=true
    

    It will be useful.

  • NULL point Exception in the method findusersfiltered

    Hello

    I use the Findusersfiltered method to get the take. But it is throwing an exception of pointer null, Findusersfiltered (Unknown source). Please let me know a workaround for this problem. Change the method of findallusers or any other method of extraction of the user key will resolve this?

    Thank you.

    Try this:

    tcUserOperationsIntf userOperationsIntf = getUtility ("Thor.API.Operations.tcUserOperationsIntf") (tcUserOperationsIntf);
    UserMap HashMap = new HashMap();
    userMap.put ("Users.User ID", username);
    tcResultSet userSet is userOperationsIntf .findAllUsers (userMap);.

  • NULL pointer exception when you try to navigate to the next record

    Dear members,

    I have an OFA Page for which I have attached a CO and I am.

    This OAF page main and detail records.

    Main folders are coming from an array of headers. Detail records are coming from an array of LINES.

    Once the page opens, a master record and its corresponding detail records are displayed. On the page that I have a next button.if that user clicks the next button, next master file and its corresponding detail records should appear.

    The code I wrote is satisfying the requirement above but when the user comes from the last record and click on the next button, an EXCEPTION of the NULL POINTER is thrown.

    Code in my AM is as follows:_


    Public Sub findNextRec()
    {
    String headerID = null;
    If (Headers_VO1 () .getFetchedRowCount () > 0)
    {

    headerID = getHeaders_VO1 () .next ().getAttribute("HeaderId").toString ();
    If (headerID! = null & & "".equalsIgnoreCase (headerID))
    {
    getLines_VO1 (.setMaxFetchSize(-1));
    getLines_VO1 () .setWhereClause (null);
    getLines_VO1 () .addWhereClause ("header_id in (: 1)" ");
    getLines_VO1 () .setWhereClauseParams (null);
    getLines_VO1 (.setWhereClauseParam(0,headerID));
    getLines_VO1 () .executeQuery ();
    }
    }
    on the other
    {
    throw new OAException (' to the last Record,"OAException.CONFIRMATION");
    }

    }

    _ Code in my CO

    In my co process form request, I have the following code:

    If (PageContext.GetParameter ("Next")! = null)
    {
    am.invokeMethod ("findNextRec");
    }

    Kindly please help me to solve this error. Thanks in advance.

    Best regards
    Arun D. Reddy

    Published by: Arun Reddy on January 28, 2011 10:03

    Arun,

    I don't know that you should get the error on line

    headerID = getHeaders_VO1 () .next ().getAttribute("HeaderId").toString ();

    To do this, divide the likme statement
    Line = getHeaders_VO1 () .next ();
    if(Row!=null)
    {
    headerID = row.getAttribute ("HeaderId") m:System.NET.SocketAddress.ToString ();

    --
    -

    -
    }

    Thank you

    With respect,
    Kali.
    OSSI.

  • BlackBerry Smartphones eception exception error when entering the "Messages".

    I have a client who uses a Blackberry World Edition (8830) and when it tries to go in Messages (by clicking on the Messages icon) it gets this error message all the time: uncaught Exception: java.lang.null.pointer

    I tried 2 types of resets, alt + Cap + del and tried to remove the battery when the BB is running and the same thing, I did a hard reset, that is wiping the BB and customer has left me a message this morning that he always gets the same error message.

    My BES Console (synchronize us with Domino servers on a Lotus Notes platform), I see that he has the

    version of the 3.0.0.81 platform

    The BlackBerry version: 4.2.2.196

    His blackberry had a Bell Mobility service.

    At present, the only other thing I can think of is to download the operating system and reload it on the BB using Desktop Manager.

    Can someone help me with this please.  I appreciate all the help.

    Robert Goupil

    BES administrator

    * Update - my client turned on his blackberry with the BES this morning and sent a message that, after activation, the problem seems to be resolved.  Now, is there something different that can be done in case this happens again, we have more than 800 users of blackberry and most of them have the 8830 model.

    Hello

    Your troubleshooting actions have been directly on the money, I see.

    HRT is the host Routing Tables. It's entries sent by the carrier.

    When you highlight the entry above and you click on register now, he recorded with the wireless network. Update the details of the device on the relay of the rim and down icons specific carrier or applicants

    I think that the problem existed in an application corrupted on the smartphone users, by recording the phone, the application

    has been refreshed. It's the first time I've seen this particular exception message solved without device

    reload. (Just for reference I read messages 133150).

    Thank you

    Don't forget to adjust your thread. Put the check mark in the green box containing your answer! Thank you

  • Continue the loop after the exception thrown in SQL

    How would continue the while loop in the code below after an exception was thrown?

    DECLARE    
    v_blob_data       BLOB;    
    v_blob_len        NUMBER;    
    v_position        NUMBER;    
    v_raw_chunk       RAW(10000);    
    v_char      CHAR(1);    
    c_chunk_len   number       := 1;    
    v_line        VARCHAR2 (32767)        := NULL;    
    v_data_array      wwv_flow_global.vc_arr2;    
    v_rows number;    
    v_sr_no number := 1;  
    v_first_line_done boolean := false;  
    v_error_cd number :=0;  
    v_quote_pos1 NUMBER;  
    v_quote_pos2 NUMBER;  
    v_enclosed_str VARCHAR(200);
    v_errmsg VARCHAR2(4000);
    
    BEGIN
    
     delete from TEMP_MM_UPDATE where username = :P1_USER_ID;
    
    -- Read data from wwv_flow_files</span>    
     select    
      blob_content    
     into v_blob_data    
     from wwv_flow_files    
     where name = :P2_FILE_UPLOAD; 
    
     v_blob_len := dbms_lob.getlength(v_blob_data);    
     v_position := 1;
    
    
    
     -- Read and convert binary to char</span>  
     WHILE ( v_position <= v_blob_len )    
     LOOP
    
    begin 
     
      v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);    
      v_char :=  chr(hex_to_decimal(rawtohex(v_raw_chunk)));    
      v_line := v_line || v_char;    
      v_position := v_position + c_chunk_len;
      
     -- When a whole line is retrieved </span>   
     IF v_char = CHR(10) THEN
     
     LOOP  
      --Make sure there's something to replace  
      IF INSTR(v_line, '"', 1, 1) = 0 THEN  
      EXIT; -- If nothing to replace, exit loop and don't try  
      END IF;  
      --Find the position of the first and second quotes in the line of text  
      v_quote_pos1 := INSTR(v_line, '"', 1, 1);  
      v_quote_pos2 := INSTR(v_line, '"', 1, 2);  
      --Extract the inner string  
      v_enclosed_str := SUBSTR(v_line, v_quote_pos1 + 1, v_quote_pos2 - v_quote_pos1 - 1);  
      --perform the replacement  
      v_line := SUBSTR(v_line, 0, v_quote_pos1 - 1) || REPLACE(v_enclosed_str, ',', '<') || SUBSTR(v_line, v_quote_pos2 + 1);  
     END LOOP; 
      
     -- Convert comma to : to use wwv_flow_utilities </span>  
     v_line := REPLACE (v_line, ',', ':');  
     v_line := REPLACE (v_line, '<', ',');  
     v_line := REPLACE (trim(v_line), '-', NULL);  
     --v_line := REPLACE (trim(v_line), '"', NULL);  
     -- Convert each column separated by : into array of data </span>    
     v_data_array := wwv_flow_utilities.string_to_table (v_line);  
     --Check to see if the row of column headers has already been parsed through  
     IF(v_first_line_done != true)THEN   
      v_first_line_done := true;  
      --Check column order in spreadsheet  
      IF(v_data_array(1)   LIKE '%Username%' AND
        v_data_array(2)  LIKE '%NDN%' AND
        v_data_array(3)  LIKE '%PCFN%' ) THEN   
       v_error_cd := 0;  
       v_line := NULL;  
      ELSE  
       v_error_cd := 1;  
      END IF;  
     --If first line is done and the column order is correct then  
     ELSIF(v_first_line_done = true AND v_error_cd = 0) THEN   
     -- Insert data into target table </span>    
     EXECUTE IMMEDIATE 'insert into TEMP_MM_UPDATE   
     (USERNAME,
       RPT_FLAG,
      PCFN)
     values (:1,:2,:3)'   
       USING   
      v_data_array(1),   
      v_data_array(2),   
      v_data_array(3);
       -- Clear out    
      v_line := NULL; v_sr_no := v_sr_no + 1; 
     
     END IF;  
     END IF;
    
    exception
    WHEN OTHERS then
      v_errmsg := SQLERRM;
      insert into temp_mm_update (username,error_desc)
      values (:P1_USER_ID, v_errmsg);
    end;
      
     END LOOP;
    
    
     
    DELETE FROM WWV_FLOW_FILES where name = :P2_FILE_UPLOAD;
    DELETE FROM TEMP_MM_UPDATE WHERE USERNAME IS NULL AND PCFN IS NULL;  
     IF(v_error_cd = 1) THEN  
    INSERT INTO temp_mm_update (USERNAME, ERROR_DESC)  
    VALUES (:P1_USER_ID, 'Error. Please check column order in spreadsheet.');  
    END IF;
    EXCEPTION
        WHEN NO_DATA_FOUND THEN
            insert into temp_mm_update (username,error_desc)
      values (:P1_USER_ID, 'No Data Found.');
     WHEN OTHERS then
      v_errmsg := SQLERRM;
      insert into temp_mm_update (username,error_desc)
      values (:P1_USER_ID, v_errmsg);  
    
    END;
    
    

    When I set the exception inside the loop, as above, the procedure seems never to end, and I end up getting a 'NOWAIT' error when I try to remove the table or something like that.

    The code works fine if I remove the 'START' just after the loop and also out of the exception within the loop, but I want to be able to specify what's wrong with each record rather than deal with the correct records and then stop after that it is a record that has, for example, 9 values in a column that accepts only 6.

    Can anyone help with this?

    Thank you

    Steven

    Play with my code I found what was wrong.
    I needed to add in the following line in my code block of exception:
    v_line := NULL; v_sr_no := v_sr_no + 1;
    
    Final code:
    DECLARE
      v_blob_data       BLOB;
      v_blob_len        NUMBER;
      v_position        NUMBER;
      v_raw_chunk       RAW(10000);
      v_char      CHAR(1);
      c_chunk_len   number       := 1;
      v_line        VARCHAR2 (32767)        := NULL;
      v_data_array      wwv_flow_global.vc_arr2;
      v_rows number;
      v_sr_no number := 1;
      v_first_line_done boolean := false;
      v_error_cd number :=0;
      v_quote_pos1 NUMBER;
      v_quote_pos2 NUMBER;
      v_enclosed_str VARCHAR(200);
      v_errmsg VARCHAR2(4000);
    BEGIN
      delete from TEMP_MM_UPDATE where username = :P1_USER_ID;
    
      -- Read data from wwv_flow_files
      select
        blob_content
        into v_blob_data
        from wwv_flow_files
        where name = :P2_FILE_UPLOAD; 
    
      v_blob_len := dbms_lob.getlength(v_blob_data);
      v_position := 1; 
    
      -- Read and convert binary to char
      WHILE ( v_position <= v_blob_len )
      LOOP
        begin
            v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
            v_char :=  chr(hex_to_decimal(rawtohex(v_raw_chunk)));
            v_line := v_line || v_char;
            v_position := v_position + c_chunk_len;
    
          -- When a whole line is retrieved 
          IF v_char = CHR(10) THEN
            LOOP
              --Make sure there's something to replace
              IF INSTR(v_line, '"', 1, 1) = 0 THEN
                EXIT; -- If nothing to replace, exit loop and don't try
              END IF;
              --Find the position of the first and second quotes in the line of text
              v_quote_pos1 := INSTR(v_line, '"', 1, 1);
              v_quote_pos2 := INSTR(v_line, '"', 1, 2);
              --Extract the inner string
              v_enclosed_str := SUBSTR(v_line, v_quote_pos1 + 1, v_quote_pos2 - v_quote_pos1 - 1);
              --perform the replacement
              v_line := SUBSTR(v_line, 0, v_quote_pos1 - 1) || REPLACE(v_enclosed_str, ',', '<') || SUBSTR(v_line, v_quote_pos2 + 1);
            END LOOP; 
    
            -- Convert comma to : to use wwv_flow_utilities 
            v_line := REPLACE (v_line, ',', ':');
            v_line := REPLACE (v_line, '<', ',');
            v_line := REPLACE (trim(v_line), '-', NULL);
            --v_line := REPLACE (trim(v_line), '"', NULL);
            -- Convert each column separated by : into array of data 
            v_data_array := wwv_flow_utilities.string_to_table (v_line);
            --Check to see if the row of column headers has already been parsed through
            IF(v_first_line_done != true)THEN
              v_first_line_done := true;
              --Check column order in spreadsheet
              IF(v_data_array(1)    LIKE '%Username%' AND
                  v_data_array(2)  LIKE '%NDN%' AND
                  v_data_array(3)  LIKE '%PCFN%') THEN
                v_error_cd := 0;
                v_line := NULL;
              ELSE
                v_error_cd := 1;
              END IF;
            --If first line is done and the column order is correct then
            ELSIF(v_first_line_done = true AND v_error_cd = 0) THEN
              -- Insert data into target table 
              EXECUTE IMMEDIATE 'insert into TEMP_MM_UPDATE
              (USERNAME,
               RPT_FLAG,
               PCFN)
              values (:1,:2,:3)'
               USING
                v_data_array(1),
                v_data_array(2),
                v_data_array(3);
               -- Clear out
                v_line := NULL; v_sr_no := v_sr_no + 1;
            END IF;
          END IF;
        exception
          WHEN OTHERS then
            v_errmsg := SQLERRM;
            insert into temp_mm_update (username,error_desc)
            values (:P1_USER_ID, v_errmsg);
    v_line := NULL; v_sr_no := v_sr_no + 1;
      END;
      END LOOP;
    
      DELETE FROM WWV_FLOW_FILES where name = :P2_FILE_UPLOAD;
      DELETE FROM TEMP_MM_UPDATE WHERE USERNAME IS NULL AND PCFN IS NULL;
      IF(v_error_cd = 1) THEN
        INSERT INTO temp_mm_update (USERNAME, ERROR_DESC)
        VALUES (:P1_USER_ID, 'Error. Please check column order in spreadsheet.');
      END IF;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        insert into temp_mm_update (username,error_desc)
        values (:P1_USER_ID, 'No Data Found.');
      WHEN OTHERS then
        v_errmsg := SQLERRM;
        insert into temp_mm_update (username,error_desc)
        values (:P1_USER_ID, v_errmsg);
    END;
    
  • Issue with the exception of the loop

    Hello

    I had 4 database, I use dblinks to check some tables and write the results in a table. I have created a table to contain the instance names so that my loop check and perform my procedure.

    declare

    sql_string1 VARCHAR2 (4000);

    sql_string2 VARCHAR2 (100);

    Start

    sql_string2: = "truncate table Backup."

    immediately run sql_string2;

    for r in (select INSTANCE_NAME, del HOST_NAME)

    loop

    sql_string1: = ' insert into Backup

    SELECT "' | r.HOST_NAME | " '  '||', '''|| r.INSTANCE_NAME | " '  '||' ,

    INPUT_TYPE, STATUS, START_TIME, END_TIME V$RMAN_BACKUP_JOB_DETAILS@'|| r.INSTANCE_NAME;

    immediately run sql_string1;

    COMMIT;

    end loop;

    exception

    WHILE OTHERS THEN

    NULL;

    end;

    /

    If all listeners work or dbs work this procedure to work with no problems but if one of them is closed, simply insert the values until it gets error but I want that if she gets error will be another value. How can I do?

    I changed the values in the table led

    SYS@crofxd01:WSTORED: > select instance_name del;

    INSTANCE_NAM

    ------------

    BLABLA

    BLABLA

    BLABLA

    BLABLA

    FPT

    only the FPT is actual instance after I performed the procedure, I want to see that FPT values inserted DB.

    Thank you

    You must move the exceptions in the loop. Like this

    declare
    sql_string1 VARCHAR2 (4000);
    sql_string2 VARCHAR2 (100);
    Start
    sql_string2: = "truncate table Backup."
    immediately run sql_string2;
    for r in (select INSTANCE_NAME, del HOST_NAME)
    loop
    sql_string1: = ' insert into Backup
    SELECT "' | r.HOST_NAME | " '  '||', '''|| r.INSTANCE_NAME | " '  '||' ,
    INPUT_TYPE, STATUS, START_TIME, END_TIME
    OF V$RMAN_BACKUP_JOB_DETAILS@'|| r.INSTANCE_NAME;
    Start
    immediately run sql_string1;
    exception
    When then
    null;
    end;

    COMMIT;
    end loop;
    end;

    But make sure that you specify that the exception in the EXCEPTION block. Do not THEN use than OTHERS. Because it will catch all exceptions (long-awaited by you and should not not by you). It will hurt one day.

  • THROWABLE-WAS-NULL error the connection after the upgrade to version 4.0.3

    I get a Java exception when I connect to Hyperic.  This started after I upgraded my server version Hyperic 3.2.4 to 4.0.3.  Everything else seems to work after I get the Java error, I would like to know how to solve this problem but it happens every time I log in.  Complete the below error and here is my server information.

    OS: RHEL 5, 64 - bit
    The Hyperic Version: HQ 4.0.3 build 953

    ===============================
    Exception:
    THROWABLE-WAS-NULL (to java.lang.Exception at org.hyperic.util.StringUtil.getStackTrace(StringUtil.java:409) at org.apache.jsp.common.GenericError_jsp._jspService (unknown Source) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) 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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:465) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398) at) org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301) at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:362) at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:283) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136) 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:856) at org.apache.coyote.http11.Http11Protocol$ Http11ConnectionHandler.processConnection (Http11Protocol.java:744) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket) PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) at java.lang.Thread.run (Unknown Source))

    It is not a problem with the upgrade, there is a problem with the URL you probably have in your bookmark or browser history of 3.2. See:

    http://JIRA.Hyperic.com/browse/HHQ-2858

    In short, no access http://server/Login.do because SignIn.html redirection causes the stacktrace. Access / or SignIn.html to avoid the error.

  • Need to get the not null fields

    Hello

    I use jdev 11.1.1.5

    I need to get all fields who r have certain values
            ViewObjectImpl vo = this.getAccountClass1();
            for (i=0;i<vo.getRowCount();i++){
                 Row vor = vo.next();
                if (vor.getAttribute("GaclSchNo").equals("NULL")){
                    System.out.println ("null");
                }
                System.out.println ("NotNull");
            }
    In this case the Null value I get an exception like Java.null.

    But I need to print Null.,.

    How can I achieve this

    Try using the code below.

    > ViewObjectImpl vo = this.getAccountClass1 ();
    > for (i = 0; i<>
    > Rank vor = vo.next ();
    > * If (vor.getAttribute ("GaclSchNo") == null) {*}
    > System.out.println ("null");
    > }
    > System.out.println ("not null");
    > }

  • Something weird with NULL operation

    First I tried to create a view to simplify the experimental query:
    create or replace force view subquery as
    select email from employees 
    where rownum<5
    union
    select null from dual
    Note that I added a null value containing the line in the last row of the view.

    Then, I tried these two:
    select * from subquery where email in (select * from subquery)
    She returned 4 lines except for the null row.

    But with this code:
    select email,(select * from subquery where email=s.email) from subquery s
    The fifth line containing null is displayed. Should not be excluded also? Thank you

    Published by: 801264 on November 16, 2010 22:46

    the last query works fine. It ignores NULL values.

    It is quite similar to an outer join (which is another possibility to demonstrate"associated NULL values" "):

    SQL> with subquery
         as (select email
               from employees
              where rownum < 5
             union
             select null from dual
    )
    --
    --
    select s1.email
      from subquery s1, subquery s2
     where s1.email = s2.email(+)
    /
    EMAIL
    -------------------------------------
    ABANDA
    ABULL
    ACABRIO
    AERRAZUR                             
    
    5 rows selected.
    

    Is there any exception for NULL operation?

    It is not an exception: it must be understood only when and where NULL operations apply.

  • Definition of focus on TextInput in Mobile app raises StyleableTextField exception

    I have a mobile small (4.5 flex) application in which I want to put a TextInput field to have focus when the view is finished being created. So in the creationComplete handler I just call setFocus on the TextInput field. However, it throws an exception of the null object in the setFocus method of StyleableTextField . It seems that the stage of field is null. Everyone fell on this? Or, there are some special conditions that must be fulfilled before it can occur without an error?

    Try waiting for the addedToStage event.

  • exceptional ends the proc or only block?

    Hi I have the following procedure shows what wil insert/delete rows in the table cache_time.

    first time cache_table has all the lines...

    If the exception statement inserts (null, sysdate) data in the table...

    now my question is... after insertion (end the proc (or) execute the delete operation that is mentioned below?)


    create or replace procedure refresh_table as

    Start

    SELECT END_TIMESTAMP IN the var_endtimestamp of cache_table;

    EXCEPTION WHEN NO_DATA_FOUND THEN
    INSERT INTO cache_table VALUES (null, SYSDATE);

    end;

    DELETE FROM cache_table;
    INSERT INTO cache_table VALUES (var_endtimestamp, SYSDATE);

    END refresh_table;

    Published by: raj_fresher on June 12, 2009 08:58

    EXCEPTION WHEN NO_DATA_FOUND THEN
    INSERT INTO cache_table VALUES (null, SYSDATE);

    -Online you need to call a stored procedure with the correct parameters, instead of insert here.

    Define the procedure as a stand-alone transaction and manage the cache_table insert it.
    And ENGAGE in your stored procedure.

Maybe you are looking for