How to convert the following code into an applet

Please reply for me as soon as you can.
import java.io.*;
import java.awt.Frame;
import java.awt.FlowLayout;
import java.awt.Color;
import java.awt.Insets;
import java.awt.Dimension;
import java.awt.event.WindowListener;
import java.awt.event.WindowEvent;
import java.util.Enumeration;
import javax.comm.CommPort;
import javax.comm.CommPortIdentifier;
import javax.comm.SerialPort;
import javax.comm.NoSuchPortException;
import javax.comm.PortInUseException;
public class BlackBox extends Frame implements WindowListener
     static int               portNum = 0,
                         panelNum = 0,
                         rcvDelay = 0;
     static SerialPortDisplay[]     portDisp;
     static BlackBox           win;
     static boolean               threaded = true,
                         silentReceive = false,
                         modemMode = false,
                         friendly = false;
     public BlackBox()
          super("Serial Port Black Box Tester");
          addNotify();
          addWindowListener(this);
     public void windowIconified(WindowEvent event)
     public void windowDeiconified(WindowEvent event)
     public void windowOpened(WindowEvent event)
     public void windowClosed(WindowEvent event)
     public void windowActivated(WindowEvent event)
     public void windowDeactivated(WindowEvent event)
     public void windowClosing(WindowEvent event)
          cleanup();
          dispose();
          System.exit(0);
     public static void main(String[] args)
          Enumeration           ports;
          CommPortIdentifier     portId;
          boolean               allPorts = true,
                         lineMonitor = false;
          int               idx = 0;
          win = new BlackBox();
          win.setLayout(new FlowLayout());
          win.setBackground(Color.gray);
          portDisp = new SerialPortDisplay[4];
          while (args.length > idx)
               if (args[idx].equals("-h"))
                    printUsage();
               else if (args[idx].equals("-f"))
                    friendly = true;
                    System.out.println("Friendly mode");
               else if (args[idx].equals("-n"))
                    threaded = false;
                    System.out.println("No threads");
               else if (args[idx].equals("-l"))
                    lineMonitor = true;
                    System.out.println("Line Monitor mode");
               else if (args[idx].equals("-m"))
                    modemMode = true;
                    System.out.println("Modem mode");
               else if (args[idx].equals("-s"))
                    silentReceive = true;
                    System.out.println("Silent Reciever");
               else if (args[idx].equals("-d"))
                    idx++;
                    rcvDelay = new Integer(args[idx]).intValue();
                    System.out.println("Receive delay = "
                              + rcvDelay + " msecs");
               else if (args[idx].equals("-p"))
                    idx++;
                    while (args.length > idx)
                         * Get the specific port
                         try
                              portId =
                              CommPortIdentifier.getPortIdentifier(args[idx]);
                              System.out.println("Opening port "
                                   + portId.getName());
                              win.addPort(portId);
                         catch (NoSuchPortException e)
                              System.out.println("Port "
                                        + args[idx]
                                        + " not found!");
                         idx++;
                    allPorts = false;
                    break;
               else
                    System.out.println("Unknown option "
                              + args[idx]);
                    printUsage();
               idx++;
          if (allPorts)
               * Get an enumeration of all of the comm ports
               * on the machine
               ports = CommPortIdentifier.getPortIdentifiers();
               if (ports == null)
                    System.out.println("No comm ports found!");
                    return;
               while (ports.hasMoreElements())
                    * Get the specific port
                    portId = (CommPortIdentifier)
                                   ports.nextElement();
                    win.addPort(portId);
          if (portNum > 0)
               if (lineMonitor)
                    if (portNum >= 2)
                         portDisp[0].setLineMonitor(portDisp[1],
                                        true);
                    else
                         System.out.println("Need 2 ports for line monitor!");
                         System.exit(0);
          else
               System.out.println("No serial ports found!");
               System.exit(0);
     private void addPort(CommPortIdentifier     portId)
          * Is this a serial port?
          if (portId.getPortType()
          == CommPortIdentifier.PORT_SERIAL)
               // Is the port in use?     
               if (portId.isCurrentlyOwned())
                    System.out.println("Detected "
                              + portId.getName()
                              + " in use by "
                              + portId.getCurrentOwner());
               * Open the port and add it to our GUI
               try
                    portDisp[portNum] = new
                         SerialPortDisplay(portId,
                                   threaded,
                                   friendly,
                                   silentReceive,
                                   modemMode,
                                   rcvDelay,
                                   win);
                    this.portNum++;
               catch (PortInUseException e)
                    System.out.println(portId.getName()
                              + " in use by "
                              + e.currentOwner);
     public void addPanel(SerialPortDisplay     panel)
          Dimension     dim;
          Insets          ins;
          win.add(panel);
          win.validate();
          dim = panel.getSize();
          ins = win.getInsets();
          dim.height = ((this.panelNum + 1) * (dim.height + ins.top
                    + ins.bottom)) + 10;
          dim.width = dim.width + ins.left + ins.right + 20;
          win.setSize(dim);
          win.show();
          panelNum++;
     static void printUsage()
          System.out.println("Usage: BlackBox [-h] | [-f] [-l] [-m] [-n] [-s] [-d receive_delay] [-p ports]");
          System.out.println("Where:");
          System.out.println("\t-h     this usage message");
          System.out.println("\t-f     friendly - relinquish port if requested");
          System.out.println("\t-l     run as a line monitor");
          System.out.println("\t-m     newline is \\n\\r (modem mode)");
          System.out.println("\t-n     do not use receiver threads");
          System.out.println("\t-s     don't display received data");
          System.out.println("\t-d     sleep for receive_delay msecs after each read");
          System.out.println("\t-p     list of ports to open (separated by spaces)");
          System.exit(0);
     private void cleanup()
          SerialPort     p;
          while (portNum > 0)
               portNum--;
               panelNum--;
               * Close the port
               p = portDisp[portNum].getPort();
               if (p != null)
                    System.out.println("Closing port "
                              + portNum
                              + " ("
                              + p.getName()
                              + ")");
                    portDisp[portNum].closeBBPort();
}

hi welcome to java forum,
please do one thing for me so that i can help you, can you put your code in a code tag [code ][code ] (without spaces) so that your code can be readable easily

Similar Messages

  • How to implement the following code into jsp

    import java.io.File;
       import javax.swing.*;
       public class Dirs {
         public static void main(String args[]) {
           SwingUtilities.invokeLater(new Runnable() {
             public void run() {
               JFileChooser fileChooser =
                      new JFileChooser(".");
               fileChooser.setMultiSelectionEnabled(true);
               fileChooser.setFileSelectionMode(
                      JFileChooser.FILES_AND_DIRECTORIES);
               int status = fileChooser.showOpenDialog(null);
               if (status == JFileChooser.APPROVE_OPTION) {
                 File selectedFiles[] =
                     fileChooser.getSelectedFiles();
                 for
                   (int i=0, n=selectedFiles.length; i<n; i++) {
                         System.out.println("Selected: "
                            + selectedFiles.getParent()
    + " --- "
    + selectedFiles[i].getName());
    System.exit(0);

    You don't, it's Swing code, client side only. The JFileChooser will open up a file dialog used to open or save files on the client machine: you have no access to the client filesystem from a jsp.

  • How to convert the text field into currency field

    Hi,
    I have an requirement to converting the text field into currency.
    If I convert directly it gives dump.
    If I convert this to Numeric means it takes the decimals also as whole value.
    Is there any FM to convert the text field into Currency field.
    Please advice me.
    Thanks in advance.

    Hi,
    I am on an SRM sytem, which unfortunately does not have th FM: PSSV_TEXT_INTO_FIELD_CURRENCY.
    But I also need to transfer a string value like '12,99' to a field with type curr.
    Can i Do that manually, or is there another FM?
    I have already checked code with write to or pack/unpack.
    But without success yet.
    Something like this:
    DATA: g_str(11) type c.
    DATA: g_p type p.
    WRITE '12,99' TO g_str CURRENCY 'EUR'.
    is no use for me. Finally I need to move g_str to my curr-field, which causes st22.
    also: PACK g_str to <curr-field or g_p> dumps.
    Help appreciated.
    regards, matthias

  • How to convert the TEXT file into an XML using plsql code

    Hi all ,
    I need to convert an TEXT file into an XML file how can i do it
    Below is my sample TEXT file .
    TDETL00000000020000000000000120131021115854ST2225SKU77598059          0023-000000010000
    I want the above to be converted into the below format
    <?xml version="1.0" encoding="UTF-8"?>
    <txt2xml>
      <!-- Processor splits text into lines -->
      <processor type="RegexDelimited">
      <regex>\n</regex>
            <!--
            This is used to specify that a message should be created per line in
            the incoming file;
            NOTE: this was designed to work with all the processors, however it
            only works correctly with 'RegexDelimited' processors (check the
            enclosing top processor type)
             -->
             <maxIterationsPerMsg>1</maxIterationsPerMsg>
      <!-- For lines beginning with FHEAD (File Header) -->
      <processor type="RegexMatch">
      <element>FHEAD</element>
      <regex>^FHEAD(.*)</regex>
      <processor type="RegexMatch">
      <element>OriginalLine</element>
      <regex>(.*)</regex>
      <consumeMatchedChars>false</consumeMatchedChars>
      </processor>
      <processor type="RegexMatch">
      <element>LineSeq,Type,Date</element>
      <regex>^(\d{10})(\w{4})(\d{14})$</regex>
      </processor>
      </processor>
      <!-- For lines beginning with TDETL (Transaction Details) -->
      <processor type="RegexMatch">
      <element>TDETL</element>
      <regex>^TDETL(.*)</regex>
      <processor type="RegexMatch">
      <element>OriginalLine</element>
      <regex>(.*)</regex>
      <consumeMatchedChars>false</consumeMatchedChars>
      </processor>
      <processor type="RegexMatch">
      <element>LineSeq,TransControlNumber,TransDate,LocationType,Location,ItemType,Item,UPCSupplement,InventoryStatus,AdjustReason,AdjustSign,AdjustQty</element>
      <regex>^(\d{10})(\d{14})(\d{14})(\w{2})(\d{4})(\w{3})([\w ]{13})([\w ]{5})(\d{2})(\d{2})([+-]{1})(\d{12})$</regex>
      </processor>
      </processor>
      <!-- For lines beginning with FTAIL (File Tail) -->
      <processor type="RegexMatch">
      <element>FTAIL</element>
      <regex>^FTAIL(.*)</regex>
      <processor type="RegexMatch">
      <element>OriginalLine</element>
      <regex>(.*)</regex>
      <consumeMatchedChars>false</consumeMatchedChars>
      </processor>
      <processor type="RegexMatch">
      <element>LineSeq,TransCount</element>
      <regex>^(\d{10})(\d{6})$</regex>
      </processor>
      </processor>
      </processor>
    </txt2xml>
    Thanks

    Sorry, that doesn't make much sense.
    The XML you gave is a configuration file for txt2xml utility. It doesn't represent the output format.
    Are you a user of this utility?

  • How to convert the source code in JSP,HTML&BEANS into executable files?

    Sir,
    We are developing one s/w product in JSP,HTML&BEANS.Now we are in the implementation phase.During the time of Installation,without copying our source code in the customer's site I want to copy the executable files of the entire source codes? Is it possible in JSP,HTML&BEANS?

    In theory you can do it even with JSP but the you will be unable to run it on the standard JSP engine. :-)
    From other hand, all critical logic should be in the Java Beans or at least in custom tags but not in the JSP code. Then you can protect that code and leave JSP open because there is nothing to steal or break.

  • How do I convert the following code from crystal reports to Reporting Services?

    stringvar rbt := "";
    if { param} = -1 then rbt := "ALL | " else rbt := {rptStoreMasterByDC;1.RegionName} + " | ";
    if {param2} = -1 then rbt := rbt + "ALL | " else rbt := rbt + {rptStoreMasterByDC;1.BranchName} + " | ";
    if {param3} = -1 then rbt := rbt + "ALL" else rbt := {rptStoreMasterByDC;1.TerritoryName};
    rbt

    Add a customer code in the report. Call it from the report tablix cell using expression. Pass param,param2,param3, RegionName, BranchName, TerritoryName as parameters of the custom function/procedure.
    Refer http://technet.microsoft.com/en-us/library/ms156028.aspx
    The custom code will look like as below.
    Public Function ChangeWord(ByVal param As Integer,ByVal param2 As Integer,ByVal param3 As Integer,ByVal RegionName As String,ByVal BranchName As String,ByVal param As Territory) As String
    Dim s as string
    If param = -1 then s = "ALL |" else s = RegionName & "|"
    If param2 = -1 then s = s & "ALL |" else s = BranchName & "|"
    If param3 = -1 then s = s & "ALL" else s = TerritoryName
    Return s
    End Function
    Regards, RSingh

  • How to convert pl/sql code into java/j2ee

    Hi,
    We have a PL/SQL Oracle App server application that we will support if we can convert in j2ee/java. But when i did take a look at the code, these pl/sql contains all HTML and java code inside the stored procedures.
    And iam looking to explore some tools and mechanisms that can convert these pl/sql in a JAVA application so that i can deploy this new app into my BEA81 environment.
    Does any body has any idea:
    a) How to convert from pl/sql > java ?
    b) Any plugins or tools of BEA that can run these pl/sql (the way thay are currently...i.e w/o converting) in BEA 81 container ?
    thanks, sangita

    these pl/sql contains all HTML and java code insideJava or JavaScript. They are not the same. I wouldn't expect to see Java inside html, whereas JavaScript would be intermixed. On the other hand you might have a java stored proc (Oracle 9/10) which is generating HTML.
    >
    Does any body has any idea:Refactor.
    I doubt it just has html and JavaScript/Java. So what you have is a mess that mixes several things that should have been seperate in the first place.

  • How to convert the following query to sql server 2005

    hi
    i have the following query in ms access and i want to convert it into sql server 2005 express edition
    SELECT iif(Max(BNo) is null,1,Max(BNo)+1) AS BNo from ( SELECT iif(Max(Product.BNo) is null,0,Max(Product.BNo)) AS BNo FROM Product union all SELECT iif(Max(grndetail.BNo) is null,0,Max(grndetail.BNo)) AS BNo FROM grndetail UNION ALL SELECT iif(Max(srdetail.BNo) is null,0,Max(srdetail.BNo)) AS BNo FROM srdetail ) as t
    how to do this

    The construct involving case when MAX sounds suspicious. Can you explain what the query is supposed to be doing, the structure of your table, then we can re-write it?
    E.g. if you provide your table, some data and desired result, you'll get better answer than direct translation of this suspicious query.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • How to convert 864 Transaction code into XML in EDI to File Scenario

    Hello Friends,
                            Can any body help me out in using 864 Transaction Code (Tex Message) in EDI to Flat File Conversion?? I mean i am using just 2 Fields i.e  Name and Address.I didnt understand the Format given<u><i>..Here is the format for Name
    N1 Name                                                           </i></u>                 Pos: 040 Max: 1
                                                                                    Heading - Optional
                                                                                    Loop: N1 Elements: 4
    To identify a party by type of organization, name, and code
    Element Summary:
    <u><i>Ref     Id       Element Name                     Req  Type    Min/Max    Usage</i></u>
    N101 98        Entity Identifier Code             M      ID        2/3          Must use
    Description: Code identifying an organizational entity, a physical
    location, property or an individual
    All valid standard codes are used.
    N102   93      Name                                  C     AN       1/60            Used
    Description: Free-form name
    N103 66        Identification Code Qualifier   C     ID        1/2              Used
    Description: Code designating the system/method of code structure used
    for Identification Code (67)
    All valid standard codes are used.
    N104 67        Identification Code                C     AN        2/80           Used
    Description: Code identifying a party or other code
    Syntax:
    1. N102 R0203 -- At least one of N102 or N103 is required.
    2. N103 P0304 -- If either N103 or N104 are present, then the others are required.
    Comments:
    1. This segment, used alone, provides the most efficient method of providing organizational identification. To obtain this efficiency the "ID Code" (N104)
    must provide a key to the table maintained by the transaction processing party.
    2. N105 and N106 further define the type of entity in N101.
    [<u>b]
    Here is the format for Address</b></u>
    N3 Address Information                                                 Pos: 060 Max: 2
                                                                                    Heading - Optional
                                                                                    Loop: N1 Elements: 2
    To specify the location of the named party
    Element Summary:
    <b><u><i>Ref            Id              Element Name            Req     Type      Min/Max   Usage</i></u></b>
    N301        166            Address Information       M        AN         1/55       Must use
    Description: Address information
    N302 166 Address Information
    Description: Address information                     O          AN         1/55       Used
    So Help me hoe to convert this into XML...

    try this
    For EDI U need SEEBURGER Adapter or Conversion agent by itemfield.
    Using Conversion agent convert EDI Into XSD and Import using External definition.
    Have look
    EDI Conversion
    Re: Seeburger Splitter adapter!!
    Thanks

  • Created my own subscription box in animate, how to embed the mail code into the symbols?

    So i think  I am on the right track, I am trying to embed my mailchimp code into my animate site, and I decided to build my own text box and button in animate and convert them into symbols. Both text box and button or inside of a bigger symbol so that they stay in a responisive design. however when I tryin and plug in the mail code it just puts the subscription box behind my symbols. Is this because html code doesnt work in animate or am I just really stupid and am doing it all wrong? Ha probably the second part, . Any help would be great!.
    Animate CC code
    <div id="Stage_Center2_Subscription">
                    <div id="Stage_Center2_Subscription_subscribe"></div>
                    <div id="Stage_Center2_Subscription_Submittbutton">
                        <div id="Stage_Center2_Subscription_Submittbutton_Submitbutton">
                            <div id="Stage_Center2_Subscription_Submittbutton_Submitbutton_RoundRect2"></div>
                        </div>
                        <div id="Stage_Center2_Subscription_Submittbutton_text">
                            <div id="Stage_Center2_Subscription_Submittbutton_text_Text">Join</div>
                        </div>
                    </div>
                    <div id="Stage_Center2_Subscription_Textbox">
                        <div id="Stage_Center2_Subscription_Textbox_textbox">
                            <div id="Stage_Center2_Subscription_Textbox_textbox_RoundRect"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
    </html>
    Mailchimp code
    <!-- Begin MailChimp Signup Form -->
    <link href="//cdn-images.mailchimp.com/embedcode/slim-081711.css" rel="stylesheet" type="text/css">
    <style type="text/css">
              #mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }
              /* Add your own MailChimp form style overrides in your site stylesheet or in this style block.
                 We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */
    </style>
    <div id="mc_embed_signup">
    <form action="http://kandied.us3.list-manage.com/subscribe/post?u=4525b320bd81872705a48ea05&id=4743a970b 1" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
              <input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>
        <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
        <div style="position: absolute; left: -5000px;"><input type="text" name="b_4525b320bd81872705a48ea05_4743a970b1" value=""></div>
              <div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
    </form>
    </div>
    <!--End mc_embed_signup-->

    Hi, Kyle-
    What's happening is that you're inserting static HTML into the base HTML of your current project.  We treat any third party static HTML as underneath all managed elements.  You can find out whether or not it's being treated as static by hovering over the element in the elements panel:
    One thing you can do is to dynamically insert your mailchimp code into a div by changing the html() property of that div using jQuery.  So, something like this:
    In compositionReady:
    sym.$("myDiv").html("INSERT MY FORM CODE HERE");
    Hope that points you in the right direction!
    -Elaine

  • How to convert the following?

    Hi ,
    Below is the java command line that I provide on dos prompt.
    How to I convert the same for unix commandline
    java -cp C:\joost-20090315\lib\joost.jar;C:/joost-20090315/lib/commons-discovery-0.4.jar;C:/joost-20090315/lib/avalon-framework-4.2.0.jar;C:/joost-20090315/lib/batik-all-1.7.jar;C:/joost-20090315/lib/bsf.jar;C:/joost-20090315/lib/commons-io-1.3.1.jar;C:/joost-20090315/lib/fop.jar;C:/joost-20090315/lib/joostGen.jar;C:/joost-20090315/lib/log4j-1.2.15.jar;C:/joost-20090315/lib/resolver.jar;C:/joost-20090315/lib/serializer.jar;C:/joost-20090315/lib/serializer-2.7.0.jar;C:/joost-20090315/lib/servlet-2.2.jar;C:/joost-20090315/lib/xalan-2.7.0.jar;C:/joost-20090315/lib/xercesImpl.jar;C:/joost-20090315/lib/xercesImpl-2.7.1.jar;C:/joost-20090315/lib/xercesSamples.jar;C:/joost-20090315/lib/xml-apisv.jar;C:/joost-20090315/lib/xml-apis-1.3.04.jar;C:/joost-20090315/lib/xml-apis-ext-1.3.04.jar;C:/joost-20090315/lib/xmlgraphics-commons-1.3.1.jar;C:/joost-20090315/lib/commons-logging.jar;C:/joost-20090315/lib/xsltc.jar net.sf.joost.Main sdeg24.xml etl_main_stx.stx
    Regards,
    s

    SDNDeveloper wrote:
    Below is the java command line that I provide on dos prompt.
    java -cp C:\joost-20090315\lib\joost.jar;C:/joost-20090315/lib/commons-discovery-0.4.jar;C:/joost-20090315/lib/avalon-framework-4.2.0.jar;C:/joost-20090315/lib/batik-all-1.7.jar;C:/joost-20090315/lib/bsf.jar;C:/joost-20090315/lib/commons-io-1.3.1.jar;C:/joost-20090315/lib/fop.jar;C:/joost-20090315/lib/joostGen.jar;C:/joost-20090315/lib/log4j-1.2.15.jar;C:/joost-20090315/lib/resolver.jar;C:/joost-20090315/lib/serializer.jar;C:/joost-20090315/lib/serializer-2.7.0.jar;C:/joost-20090315/lib/servlet-2.2.jar;C:/joost-20090315/lib/xalan-2.7.0.jar;C:/joost-20090315/lib/xercesImpl.jar;C:/joost-20090315/lib/xercesImpl-2.7.1.jar;C:/joost-20090315/lib/xercesSamples.jar;C:/joost-20090315/lib/xml-apisv.jar;C:/joost-20090315/lib/xml-apis-1.3.04.jar;C:/joost-20090315/lib/xml-apis-ext-1.3.04.jar;C:/joost-20090315/lib/xmlgraphics-commons-1.3.1.jar;C:/joost-20090315/lib/commons-logging.jar;C:/joost-20090315/lib/xsltc.jar net.sf.joost.Main sdeg24.xml etl_main_stx.stx
    I would probably use
    java -Djava.ext.dirs=/joost-20090315/lib net.sf.joost.Main sdeg24.xml etl_main_stx.stxwhich should work on both Windows and linux.

  • How to compile the java code into machine execution code?

    Does anyone can tell me how to compile java code into machine execution code on specific OS platform such as Windows2000 , UNIX �Ketc.
    Thanks a lot !

    Hi SIR
    It is very kind of you to give me so great informatin!
    Thanks a lot!
    Caton

  • How to convert the local file into unicode file?

    Hi All,
    I need read local file (GUI_UPLOAD) and save it as unicode file?
    I've found class CL_ABAP_CONV_OUT_CE but I've no idea how to use it.
    Should I read file in binary mode and then convert it into unicode? AT the and save it (GUI_DOWNLOAD) ?
    Thanks
    Adam

    Hi,
    Check these classes, will help you
    CL_ABAP_CONV_IN_CE : Reading binary data
    CL_ABAP_CONV_OUT_CE : exporting binary data
    CL_ABAP_CONV_X2X_CE : reading and exporting binary data and changing the format
    Regards,
    Satish

  • How to convert the exponential data into number

    Hi,
    I have a table with a column which is a vaarchar2(60). I have a CSV file in which, I have stored value as 77052512125510000, but it got converted into 7.71E16. And when I have stored the same in the database, it got saved as 7.71E16. How can I get the original value
    Please help
    Regards
    Edited by: Sarma12 on May 25, 2012 3:11 AM

    Sarma12 wrote:
    The issue is, the data is already copied into the database. Now while retrieving from the database, I am getting that value in the scientific notation and not similar to the data which I have in the CSV file.
    RegardsYou need to be smarter than the tools you use
    bcm@bcm-laptop:~$ sqlplus user1/user1
    SQL*Plus: Release 11.2.0.1.0 Production on Fri May 25 09:50:02 2012
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    09:50:03 SQL> @test
    09:50:07 SQL> drop table test;
    Table dropped.
    09:50:09 SQL> create table test (id number);
    Table created.
    09:50:10 SQL> insert into test values (77052512125510000);
    1 row created.
    09:50:10 SQL> select * from test;
         ID
    7.7053E+16
    09:50:10 SQL> column id format 999999999999999999999
    09:50:10 SQL> select * from test;
                  ID
         77052512125510000
    09:50:10 SQL>
    09:50:10 SQL>

  • How to convert the following FORALL Update to direct SQL UPDATE statement

    I have a FORALL loop to update a table. It is taking too long. I want to rewrite the code to a direct UPDATE sql. Also, any other tips or hints which can help run this proc faster?
    CURSOR cur_bst_tm IS
    SELECT listagg(tm, ' ') WITHIN GROUP(ORDER BY con_addr_id) best_time,
           con_addr_id
       FROM   (select Trim(Upper(con_addr_id)) con_addr_id,
                      ||decode(Initcap(start_day),
                                      'Monday', 'm',
                                    'Tuesday', 'tu',
                                    'Wednesday', 'w',
                                    'Thursday', 'th',
                                    'Friday', 'f',
                                     Initcap(start_day))
                      ||'='
                      ||trunc(( ( TO_DATE(start_tm,'HH12:MI:SS PM') - trunc(TO_DATE(start_tm,'HH12:MI:SS PM')) ) * 24 * 60 ))
                      ||','
                      ||trunc(( ( TO_DATE(end_tm,'HH12:MI:SS PM') - trunc(TO_DATE(end_tm,'HH12:MI:SS PM')) ) * 24 * 60 )) tm
               FROM   (SELECT DISTINCT * FROM ODS_IDL_EDGE_OFFC_BST_TM)
                 WHERE con_addr_id is not null)
      GROUP  BY con_addr_id
      ORDER BY con_addr_id;
    TYPE ARRAY IS TABLE OF cur_bst_tm%ROWTYPE;
    l_data ARRAY;
    BEGIN
    OPEN cur_bst_tm;
         LOOP
        FETCH cur_bst_tm BULK COLLECT INTO l_data LIMIT 1000;
        FORALL i IN 1..l_data.COUNT
          UPDATE ODS_CONTACTS_ADDR tgt
          SET best_times = l_data(i).best_time,
          ODW_UPD_BY = 'IDL - MASS MARKET',
           ODW_UPD_DT = SYSDATE,
          ODW_UPD_BATCH_ID = '0'
          WHERE Upper(edge_id) = l_data(i).con_addr_id
           AND EXISTS (SELECT 1 FROM ods_idl_edge_cont_xref src
                       WHERE tgt.contacts_odw_id = src.contacts_odw_id
                          AND src.pc_flg='Y')  
        EXIT WHEN cur_bst_tm%NOTFOUND;
        END LOOP;
      CLOSE cur_bst_tm;Record count:-
    select count(*) from
    ODS_IDL_EDGE_OFFC_BST_TM;
    140,000
    SELECT count(*)
    FROM ods_idl_edge_cont_xref src
    WHERE src.pc_flg='Y';
    118,000
    SELECT count(*)
    FROM ODS_CONTACTS_ADDR;
    671,925
    Database version 11g.
    Execution Plan for the update:
    Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    UPDATE STATEMENT Optimizer Mode=ALL_ROWS          6 K          8120                     
    UPDATE     ODW_OWN2.ODS_CONTACTS_ADDR                                   
    HASH JOIN SEMI          6 K     256 K     8120                     
    TABLE ACCESS FULL     ODW_OWN2.ODS_CONTACTS_ADDR     6 K     203 K     7181                     
    TABLE ACCESS FULL     ODW_OWN2.ODS_IDL_EDGE_CONT_XREF     118 K     922 K     938
    Edited by: user10566312 on May 14, 2012 1:07 AM

    The code tag should be in lower case like this {noformat}{noformat}. Otherwise your code format will be lost.
    Here is a update statementupdate ods_contacts_addr tgt
    set (
              best_times, odw_upd_by, odw_upd_dt, odw_upd_batch_id
         ) =
              select best_time, odw_upd_by, odw_upd_dt, odw_upd_batch_id
              from (
                   select listagg(tm, ' ') within group(order by con_addr_id) best_time,
                        'IDL - MASS MARKET' odw_upd_by,
                        sysdate odw_upd_dt,
                        '0' odw_upd_batch_id,
                        con_addr_id
                   from (
                             select Trim(Upper(con_addr_id)) con_addr_id,
                                  ||decode(Initcap(start_day), 'Monday', 'm', 'Tuesday', 'tu', 'Wednesday', 'w', 'Thursday', 'th', 'Friday', 'f', Initcap(start_day))
                                  ||'='
                                  ||trunc(((TO_DATE(start_tm,'HH12:MI:SS PM')-trunc(TO_DATE(start_tm,'HH12:MI:SS PM')))*24*60 ))
                                  ||','
                                  ||trunc(((TO_DATE(end_tm,'HH12:MI:SS PM')-trunc(TO_DATE(end_tm,'HH12:MI:SS PM')))*24*60)) tm
                             FROM (
                                  select distinct * from ods_idl_edge_offc_bst_tm
                             WHERE con_addr_id is not null
                   group
                   by con_addr_id
              where upper(tgt.edge_id) = con_addr_id
    where exists
              SELECT 1
              FROM ods_idl_edge_cont_xref src
              WHERE tgt.contacts_odw_id = src.contacts_odw_id
              AND src.pc_flg='Y'
    and exists
              select null
              from (
                   SELECT listagg(tm, ' ') WITHIN GROUP(ORDER BY con_addr_id) best_time,
                        'IDL - MASS MARKET' odw_upd_by,
                        SYSDATE odw_upd_dt,
                        '0' odw_upd_batch_id,
                        con_addr_id
                   FROM (
                             select Trim(Upper(con_addr_id)) con_addr_id,
                                  ||decode(Initcap(start_day), 'Monday', 'm', 'Tuesday', 'tu', 'Wednesday', 'w', 'Thursday', 'th', 'Friday', 'f', Initcap(start_day))
                                  ||'='
                                  ||trunc(((TO_DATE(start_tm,'HH12:MI:SS PM')-trunc(TO_DATE(start_tm,'HH12:MI:SS PM')))*24*60 ))
                                  ||','
                                  ||trunc(((TO_DATE(end_tm,'HH12:MI:SS PM')-trunc(TO_DATE(end_tm,'HH12:MI:SS PM')))*24*60)) tm
                             FROM (
                                  SELECT DISTINCT * FROM ODS_IDL_EDGE_OFFC_BST_TM
                             WHERE con_addr_id is not null
                   GROUP
                   BY con_addr_id
              where upper(tgt.edge_id) = con_addr_id
    This is an untested code. If there is any syntax error then please fix it and try.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • Skype doesn't work correctly with my IP

    I have a problem with Skype during last month with my IP address. (Of course, I use last version on all of my platforms). One of my account which I use on Windows 8.1, after connecting shows my status like "Offline" (icon rolling "Connectiong..."), a

  • Is it possible to programatically enable/disable a schedule?

    Hi, I'm looking for a way to start and stop an existing schedule based on certain criteria. Is it possible to enable/disable a schedule programatically, from within an Action block?  Calling an HTTP URL for example? Thanks.

  • T-mobile unfair practice

    I am stationed with military in Spain and was in United States for a week and needed to get an unlocked phone for use overseas, which I was paying full price $650. I went to to T-Mobile store since I needed to purchase a prepaid SIM for the week.  Th

  • YouTube Subscriptions not working...

    Hi and thanks for reading. I see there are some posts on some youtube subscriptions issues in AppleTV forum but mine is an easy one and is related to my ipad and iphone. The issue I have is that I cannot see any subscription in "my subscription" fold

  • Audio Video Bridging on Cisco Switches

    Hi All,        I'm looking to implement AVB (IEEE 802.1AS, 802.1Qav, 802.1Qat and 802.1BA) on Cisco switches. I've searched on these forums, Cisco's website and google for any information there might be about AVB support on any Cisco switches. The cl