Buffered Reader or String Buffer size.

Hi.
Is it possible to limit the size of a Buffered Reader input from the keyboard to a specific number? how would one go about it?

I would like to limit the size of the buffered reader to ensure a minimum or maxim number of input is put in. I tried using the ensureCapacity class but there seems to be a problem in calling the class. the code is below
import java.io.*;
import java.awt.*;
public class getUserString {
     public static void main (String [] args) throws Exception {
          int levl, x, load;
          String s1, s2;
          String input = " ";
          StringBuffer buf = new StringBuffer();
          System.out.println ("Enter a string of at least 4 characters");
          System.out.println ("Please do not enter a character more than once");
          BufferedReader mark = new BufferedReader(new InputStreamReader(System.in));
          mark.ensureCapacity(4);
          try{
               s1 = mark.readLine();
               System.out.println ("These are the characters you have entered: " + s1);
          catch(IOException e) {
                e.printStackTrace();
}

Similar Messages

  • Benefit of pre allocating String buffer size

    Hi,
    I have come across the following code when redesigning someones application (simplified!):
    public class myClass{
        private int approxLength = 1000;
        private void myMethod(){
            // Allocate the buffers with the right length, so they
            // are not reallocated all the time
            StringBuffer s = new StringBuffer(approxLength);
            while(do lots of times){
                s.append(someStuff);
            approxLength = s.length();
    }Now my point is, does pre-allocating the StringBuffer size really give much benefit? What is the default size when a SB is allocated using the no-arg constructor? Will it slow the app much if I create the Buffer without a default size?
    I think the code is messy and less readable with this "approxLength" idea, and would like to get rid of it if it wont cause any performance issues

    JN + DrClap,
    After reading what I wrote I can see where my babble may have been difficult to decipher. I was thinking faster than I could type. And you were right, a StringBuffer does conserve on memory reads and writes... For each String concatenation there is n + 2 memory segments allocated (unless resultant segment is rewritten... Don't know!). This reason alone is probably why the StringBuffer was created, with the exception of ease of use. But as the StringBuffer's size increases the probability of maximum utilization lessens for a randomized number of bytes being appended (Within the confines of the java language's capabilities and constraints). Its like a numbers game... Guessing a truly randomized number 1 through 10 has a much higher probability than guessing a number 1 through 1000000. So as the size of the StringBuffer increases efficiency decreases for a random byte length append. Which ultimately leads to wasted memory utilization.
    JP

  • Sychronize AO/AI buffered data graph and measure data more than buffer size

    I am trying to measure the response time (around 1ms) of the pressure drop indicated by AI channel 0 when the AO channel 0 gives a negetive single pulse to the unit under test (valve). DAQ board: Keithley KPCI-3108, LabView Version: 6.1, OS system: Win2000 professional.
    My problem is I am getting different timed graph between the AI and AO channels every time I run my program, except the first time I can get real time graph. I tried to decrease the buffer size less than the max buffer size of the DAQ board (2048 samples), but it still does unreal time graph from AI channel, seems it was still reading from old data in the buffer when AO writes the new buffer data, that is my guessing. In my p
    rogram, the AO and AI part is seperated, AO Write buffer is in a while loop while AI read is not. Would that be a problem? Or it's something else?
    Also, I am trying to measure data much larger than the board buffer size limit. Is it possible to make the measurement by modifying the program?
    I really appreciate any of your help. Thank you very much!
    Best,
    Jenna

    Jenna,
    You can modify the X-axis of a chart/graph in LabVIEW to display real-time. I have included a link below to an example program that illustrates how to do this.
    If you are doing a finite, buffered acquisition make sure that you are always reading everything from the buffer for each run. In other words, If you set a buffer size of 5000, then make sure you are reading 5000 scans (set number of scans to read to 5000). This will assure you are reading new data every time you run you program. You could always put the AI Read VI within a loop and read a smaller number from the buffer until the buffer is empty (monitor the scan backlog output of the AI Read VI to see how many scans are left in the buffer).
    You can set a buffer size larger than the FIFO
    buffer of the hardware. The buffer size you set in LabVIEW is actually a software buffer size within your computer's memory. The data is acquired with the hardware, stored temporarily within the on-board FIFO, transferred to the software buffer, and then read in LabVIEW.
    Are you trying to create a TTL square wave with the analog output of the DAQ device? If so, the DAQ device has counters that can generate a highly accurate digital pulse as well. Just a suggestion. LabVIEW has a variety of shipping examples that are geared toward using counters (find examples>>DAQ>>counters). I hope this helps.
    Real-Time Chart Example
    http://venus.ni.com/stage/we/niepd_web_display.DISPLAY_EPD4?p_guid=B45EACE3E95556A4E034080020E74861&p_node=DZ52038&p_submitted=N&p_rank=&p_answer=&p_source=Internal
    Regards,
    Todd D.
    National Instruments
    Applications Engineer

  • How to read messages longer than network buffer size

    The logic of my application is:
    the client sends a request to the server and wait, in blocking mode, for its response.
    The server can responde with strings longer than 64KB (size of their sending and receiving buffer size), so under the hood, can also execs more than one socketChannel.write
    Nothing in the message says where it finish, nevertheless the client needs to assemble all in one big
    string.
    How can the client deal with this ? I'd like keep it as simple as possible (without using a selector)
    any thoughts ?
    thanks in advance

    Your above post suggests that it can send more than one packet (even ignoring the 64k limit.)
    In that case the data of the message must contain sufficient information. If not then the solution is not determinate.
    Ideally what you should received is a message and not just data. The message defines it contents. So you know how long it is and maybe even when it ends.
    Alternatively the data might contain something. For example if you are recieving well formatted XML then you can create a simple parser that just looks for the end tag. If it isn't well formatted, or at least you can not rely on that then it is much harder.

  • Doing Buffered Event count by using Count Buffered Edges.vi, what is the max buffer size allowed?

    I'm currently using Count Buffered Edges.vi to do Buffered Event count with the following settings,
    Source : Internal timebase, 100Khz, 10usec for each count
    gate : use the function generator to send in a 50Hz signal(for testing purpose only). Period of 0.02sec
    the max internal buffer size that i can allocate is only about 100~300. Whenever i change both the internal buffer size and counts to read to a higher value, this vi don't seem to function well. I need to have a buffer size of at least 2000.
    1. is it possible to have a buffer size of 2000? what is the problem causing the wrong counter value?
    2. also note that the size of max internal buffer varies w
    ith the frequency of signal sent to the gate, why is this so? eg: buffer size get smaller as frequency decrease.
    3. i'll get funny response and counter value when both the internal buffer size and counts to read are not set to the same. Why is this so? is it a must to set both value the same?
    thks and best regards
    lyn

    Hi,
    I have tried the same example, and used a 100Hz signal on the gate. I increased the buffer size to 2000 and I did not get any errors. The buffer size does not get smaller when increasing the frequency of the gate signal; simply, the number of counts gets smaller when the gate frequency becomes larger. The buffer size must be able to contain the number of counts you want to read, otherwise, the VI might not function correctly.
    Regards,
    RamziH.

  • HttpServer error in reading buffer size via keyboard input - HELP

    I've written a simple HttpServer program that reads keyboard input to construct a buffer to copy the requested file into the socket's output stream. I've done the string-to-integer conversion using BufferedReader and parse.Int. However, when I go to use the int later in the program, I keep getting the message "variable b may not have been initialized." Can anyone tell me what's missing from the code below? Thanks.
    private static void sendBytes(FileInputStream fis, OutputStream os)throws Exception
         //Construct a buffer via console input
         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
         String str;
         int b;
              System.out.println("Enter desired buffer size or CTRL-C to break.");
         //Convert entry to an integer
         do
              str = br.readLine();
                 try
                   b = Integer.parseInt(str);
              catch(NumberFormatException e)
                   System.out.println("Invalid entry.");
         while((str=br.readLine())!=null);
         //Construct a buffer
         byte[] buffer = new byte;
         int bytes = 0;
         //Begin timing HTML page delivery
         long start, end;
              System.out.println("Timing for Web page delivery");
         start = System.currentTimeMillis();
         //Copy requested file into the socket's output stream
              while((bytes = fis.read(buffer)) != -1)
              os.write(buffer, 0, bytes);

    As the message suggests, what is missing is code to initialize the variable b. The first mention ("int b;") does not initialize it. The second mention ("b = Integer.parseInt(str);") only initializes it if no exception is thrown. So it's possible for b to be uninitialized when you actually try to use it.
    What do you need to change? First you need to decide what's to be done if the keyboard input isn't a valid integer. Do you have a default value in mind? If so, put that where you declare the variable ("int b = 42;"). If not, just initialize the variable to zero ("int b = 0;").

  • FMS3 - Read buffer size

    Hello,
    I'm currently testing my custom file plugin, and I've noticed
    that FMS uses rather small
    buffer sizes when reading files (256K at most, sometimes only
    reading 1 or 2 bytes at a time).
    Is there a way to increase the buffer sizes? 1MB reads would
    be much more efficient.
    I've also noticed that every time a read takes place, the
    server opens, reads and then promptly
    closes the file after reading just one chunk, resulting in
    thousands of open/read/close cycles
    for a single session. (Very inefficient) Is there a reason
    for that behavior?
    Thanks,
    Gilad

    Of course I don't know why this happens, but given that what you expect as a message length seems not to be quite random, but rather some text in English, tells me that certain things are shifted in your buffers. Maybe the buffers are sometimes build incorrectly or read incorrectly. You see, the probability of assembling "icy-" out of 4 bytes is about 1 in 4 millions. I would assume this is a piece of text that is wrongly assumed to be the mesage length.

  • How does buffer size affect double buffered waveform generation?

    I had originally posted the following question:
    "Why does the double buffered waveform generation pause after the first buffer before continuing?"
    "I am using an AT-AO-10 board to generate a multiple channel waveform in double buffered mode. The board's DAC's are updated by an external clock signal. While the waveform generation performs well, I notice that after the first buffer has been generated there is a time delay before the next buffer is output. However the second buffer and thereafter perform well without any time delays. If anyone can provide me an explanation on why this happens I would appreciate it. I am using NI-DAQ API functions to generate the waveforms and my settings for the WFM_DB_Config function are 1 for oldDataStop to disallow regeneration of data and 0 for partialTransferStop to not stop when a half buffer is partially transferred."
    -posted by Vadi on 6/7/2001
    I received a response from Geneva as follows:
    Geneva L. on 6/11/2001 says:
    "Vadi,
    The first thing is to make sure that you have the latest version of NI-DAQ installed, NI-DAQ 6.9.1. If you need to install it, make sure you completely uninstall any prior versions. Then, you will have examples installed in either the NI-DAQ or the CVI directory. In the AO directory, you should find the WFMdoubleBuf example.
    Start with that to make sure the output appears as you expect. Then, you can modify it to apply your external update clock, following the idea presented in the WFMsingleBufExtUpdate example. You might even want to double-check that your external clock acts as you expect using an oscilloscope.
    Finally, modify the example such that you can update on multiple channels, remembering that you interleave each channels buffer into one buffer for WFM_DB_Transfer. Whatever data is in the buffer will be updated on the output channels.
    Regards,
    Geneva L.
    Applications Engineer
    National Instruments"
    I have checked my version of NI-DAQ and it is 6.9.1. I am generating the double buffered waveform according to the format shown in WFMdoubleBuf and with some modifications from WFMsingleBufExtUpdate to allow me to use my external update clock. However I continue to notice the same phenomena again and again. For a buffer size of 7500 or 10000 points there is a time lag meaning after the first buffer has been output there is a noticeable time delay before the second buffer and buffers there after is output. This time lag doesn't exist for the buffers that are output after the first buffer but it does exist for the first buffer. When I decrease the buffer size down to 5000 points the time lag disappears (Note: this phenomena also occurs when I use an internal time base as opposed to my external clock). Is there a reason for this? I am using a AT-AO-10 board and I know the on board FIFO is 1024 points deep. However from the documentation provided it doesn't indicate that double buffered mode uses the on board FIFO at all. In fact, the functions require that the FIFO mode be turned off (in WFM_Load) for double buffered waveform generation. Is there a reason why when the buffer size is increased that there is a time lag after the first buffer? Is this because of the functions themselves or is this because of the AT-AO-10 board?

    Vadi,
    Make sure that your buffer size is set to the same number of points that you're actually writing to the buffer initially. For instance, if you run the example as-is, the NIDAQMakeBuffer puts exactly the ulCount amount of data into the buffer. Then, it continuously writes out half buffers. Thus, if you are not writing enough data to fill up the buffer the first time, there will be that lag until the section where half buffers are output.
    Regards,
    Geneva L.
    Applications Engineer
    National Instruments
    http://www.ni.com/ask

  • Data retrieval buffers - buffer size and sort buffer size

    Any difference to tune BSO and ASO on data retrieval buffers?
    From Oracle documentation, the buffer size setting is per database per Essbase user i.e. more physical memory will be used if there are lots of concurrent data access from users.
    However even for 100 concurrent users, default buffer size of 10KB (BSO) or 20KB (ASO) seems very small compare to other cache setting (total buffer cache is 100*20 = 2MB). Should we increase the value to 1000KB to improve the data retrieval performance by users? The improvement impact is the same for online application e.g. Hyperion Planning and reporting application e.g. Financial Reporting?
    Assume 3 Essbase plan types with 100 concurrent access:
    PLAN1 - 1000KB * 100 = 100MB 1000KB * 100 = 100MB (total sort buffer size)
    PLAN2 - 1000KB * 100 = 100MB 1000KB * 100 = 100MB (total sort buffer size)
    PLAN3 - 1000KB * 100 = 100MB 1000KB * 100 = 100MB (total sort buffer size)
    Total physical memory required is 600MB.
    Thanks in advance!

    256 samples Buffer size will always give you a noticable amount of latency. If you use Software Monitoring you should try setting your Buffer to 64 samples. With the recording delay slider in the preferences->Audio you can compensate for the latency (of course not in realtime) so that the Audio will be placed exactly there, where it should hae been recorded at. In your case set it to a -value. A loopback test (check the link below) will clarify the exact amount of Latency occuring on your system.
    http://discussions.apple.com/thread.jspa?threadID=1883662&tstart=0

  • PLEASE can a AE from NI take a look at my problem. Sound input read behave in strange manner then the buffer size is larger than 2X number of samples to read.

    On my computer I have discovered some strange behavior then reading data from the sound card. Then the buffer size is 2x samples to read everything is as expected. But since I read the sound card 10 times pr second I feel a .2 second buffer is to small. I am using XP, and XP is not a RTOS so with a buffer set to 0.2 seconds I may lose data. Therefore I set the buffer size (number samples/ch on Sound Input Configure.vi) to be in range of 2 seconds. The result then is that then reading from Sound input.vi, a reading often take more than 0.1 second. On my computer it is often 500mSec. Then the next 5 read follows with almost zero interval. I do not loose data. But on my front panel the graphs looks like an very early silent movie. This error was introduced in Labview 8.x. To be honest I think the labview 7.x sound system was much better in many ways.
    But before I point any finger NI. Other people has to verify the behavior I experience. I have made an example showing this error. It is a modified version  of the "Continuous Sound Input.vi" example. Then the "buffer in seconds" control is set to 0.2 every thing works OK. Changer this to a larger number will produce the mentioned above hiccup. The larger number in this control the larger hiccup. Is it any way to fix this? My solution up to now has to use a free 3. part software(http://www.zeitnitz.de/Christian/index.php?sel=wav​eio) But I guess it soon will be outdated. It may not work with newer windows versions.
    Any help at all will be appreciated 
    And yes I have the most updated version fo DirectX. Also I se this in Labview 2009 which I have trail version of. The VI I have made is in 8.6
    Message Edited by Coq Rouge on 09-07-2009 10:54 AM
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)
    Attachments:
    Continuous Sound Input with timing.vi ‏23 KB

    macaba wrote:
    If you take a moving average of the 0.2s buffer vs. 3s buffer at an update rate of 10, then they are the same (just under 100ms), so the average refresh rate is the same. I agree that is odd behaviour that the time between sound reads go to zero quite a lot then take a long time once in a while (presumably to fill the buffer
    I guess it goes to zero because it is reading data from the buffer it do not has to wait for data from the sound card. The mysterious thing is the periodic delay. You are also correct then saying that average timing is correct. And in my application I have no data loss.
    If you search for sound in this forum you will find out that many people has reported trouble with the sound system.
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • What is ths maximum PDO read buffer size using the Series 2 CAN cards?

    Does anyone know the maximum size for the PDO read buffer when using a Series 2 PCI NI-CAN card?

    Hi
    The maximum size for a single PDO does not depent on the series of your board it is depending on what else you are doing with the CANopen Library.
    The board uses a specific shared memory to transfer messages between driver and hardware. The size of this memory fits nearly 350 messages.
    The CANopen Config takes 100 messages for different services like NMT. That means the maximum size for a single PDO would be approx. 250 messages.
    Or for 5 different PDOs 50 each. But normaly you can leave the buffer size to zero, thus the PDO Read would allways read the newest data.
    This calculation is true for the board. That means you have 350 messages per board and 2 ports whould need to share the memory.
    DirkW

  • Default buffer size to read/write LOBs

    What is the default buffer size used by the iFS APIs when reading/writing LOBs?

    What is the default buffer size used by the iFS APIs when
    reading/writing LOBs?
    64K

  • What's the optimum buffer size?

    Hi everyone,
    I'm having trouble with my unzipping method. The thing is when I unzip a smaller file, like something 200 kb, it unzips fine. But when it comes to large files, like something 10000 kb large, it doesn't unzip at all!
    I'm guessing it has something to do with buffer size... or does it? Could someone please explain what is wrong?
    Here's my code:
    import java.io.*;
    import java.util.zip.*;
      * Utility class with methods to zip/unzip and gzip/gunzip files.
    public class ZipGzipper {
      public static final int BUF_SIZE = 8192;
      public static final int STATUS_OK          = 0;
      public static final int STATUS_OUT_FAIL    = 1; // No output stream.
      public static final int STATUS_ZIP_FAIL    = 2; // No zipped file
      public static final int STATUS_GZIP_FAIL   = 3; // No gzipped file
      public static final int STATUS_IN_FAIL     = 4; // No input stream.
      public static final int STATUS_UNZIP_FAIL  = 5; // No decompressed zip file
      public static final int STATUS_GUNZIP_FAIL = 6; // No decompressed gzip file
      private static String fMessages [] = {
        "Operation succeeded",
        "Failed to create output stream",
        "Failed to create zipped file",
        "Failed to create gzipped file",
        "Failed to open input stream",
        "Failed to decompress zip file",
        "Failed to decompress gzip file"
        *  Unzip the files from a zip archive into the given output directory.
        *  It is assumed the archive file ends in ".zip".
      public static int unzipFile (File file_input, File dir_output) {
        // Create a buffered zip stream to the archive file input.
        ZipInputStream zip_in_stream;
        try {
          FileInputStream in = new FileInputStream (file_input);
          BufferedInputStream source = new BufferedInputStream (in);
          zip_in_stream = new ZipInputStream (source);
        catch (IOException e) {
          return STATUS_IN_FAIL;
        // Need a buffer for reading from the input file.
        byte[] input_buffer = new byte[BUF_SIZE];
        int len = 0;
        // Loop through the entries in the ZIP archive and read
        // each compressed file.
        do {
          try {
            // Need to read the ZipEntry for each file in the archive
            ZipEntry zip_entry = zip_in_stream.getNextEntry ();
            if (zip_entry == null) break;
            // Use the ZipEntry name as that of the compressed file.
            File output_file = new File (dir_output, zip_entry.getName ());
            // Create a buffered output stream.
            FileOutputStream out = new FileOutputStream (output_file);
            BufferedOutputStream destination =
              new BufferedOutputStream (out, BUF_SIZE);
            // Reading from the zip input stream will decompress the data
            // which is then written to the output file.
            while ((len = zip_in_stream.read (input_buffer, 0, BUF_SIZE)) != -1)
              destination.write (input_buffer, 0, len);
            destination.flush (); // Insure all the data  is output
            out.close ();
          catch (IOException e) {
            return STATUS_GUNZIP_FAIL;
        } while (true);// Continue reading files from the archive
        try {
          zip_in_stream.close ();
        catch (IOException e) {}
        return STATUS_OK;
      } // unzipFile
    } // ZipGzipperThanks!!!!

    Any more hints on how to fix it? I've been fiddling
    around with it for an hour..... and throwing more
    exceptions. But I'm still no closer to debugging it!
    ThanksDid you add:
    e.printStackTrace();
    to your catch blocks?
    Didn't you in that case get an exception which says something similar to:
    java.io.FileNotFoundException: C:\TEMP\test\com\blah\icon.gif (The system cannot find the path specified)
         at java.io.FileOutputStream.open(Native Method)
         at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
         at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
         at Test.unzipFile(Test.java:68)
         at Test.main(Test.java:10)Which says that the error is thrown here:
         // Create a buffered output stream.
         FileOutputStream out = new FileOutputStream(output_file);Kaj

  • What is the default buffer size if we dont specify in buffer write?

    If we dont specify what is the default buffer size in BufferedWriter. How to increase/decrease the size of it?
    What is the purpose of flush?
    If flush() is not used, only partial content is written to the file. Is it because of the default size of the buffer.

    THis is the bufferedwriter class, it helps to look at them, look at the bold underlined, thats answers your defualt buffer size
    * @(#)BufferedWriter.java     1.26 03/12/19
    * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
    * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
    package java.io;
    * Write text to a character-output stream, buffering characters so as to
    * provide for the efficient writing of single characters, arrays, and strings.
    * <p> The buffer size may be specified, or the default size may be accepted.
    * The default is large enough for most purposes.
    * <p> A newLine() method is provided, which uses the platform's own notion of
    * line separator as defined by the system property <tt>line.separator</tt>.
    * Not all platforms use the newline character ('\n') to terminate lines.
    * Calling this method to terminate each output line is therefore preferred to
    * writing a newline character directly.
    * <p> In general, a Writer sends its output immediately to the underlying
    * character or byte stream. Unless prompt output is required, it is advisable
    * to wrap a BufferedWriter around any Writer whose write() operations may be
    * costly, such as FileWriters and OutputStreamWriters. For example,
    * <pre>
    * PrintWriter out
    * = new PrintWriter(new BufferedWriter(new FileWriter("foo.out")));
    * </pre>
    * will buffer the PrintWriter's output to the file. Without buffering, each
    * invocation of a print() method would cause characters to be converted into
    * bytes that would then be written immediately to the file, which can be very
    * inefficient.
    * @see PrintWriter
    * @see FileWriter
    * @see OutputStreamWriter
    * @version      1.26, 03/12/19
    * @author     Mark Reinhold
    * @since     JDK1.1
    public class BufferedWriter extends Writer {
    private Writer out;
    private char cb[];
    private int nChars, nextChar;
    private static int defaultCharBufferSize = 8192;
    * Line separator string. This is the value of the line.separator
    * property at the moment that the stream was created.
    private String lineSeparator;
    * Create a buffered character-output stream that uses a default-sized
    * output buffer.
    * @param out A Writer
    *public BufferedWriter(Writer out) {*
    *     this(out, defaultCharBufferSize);*
    * Create a new buffered character-output stream that uses an output
    * buffer of the given size.
    * @param out A Writer
    * @param sz Output-buffer size, a positive integer
    * @exception IllegalArgumentException If sz is <= 0
    public BufferedWriter(Writer out, int sz) {
         super(out);
         if (sz <= 0)
         throw new IllegalArgumentException("Buffer size <= 0");
         this.out = out;
         cb = new char[sz];
         nChars = sz;
         nextChar = 0;
         lineSeparator =     (String) java.security.AccessController.doPrivileged(
    new sun.security.action.GetPropertyAction("line.separator"));
    /** Check to make sure that the stream has not been closed */
    private void ensureOpen() throws IOException {
         if (out == null)
         throw new IOException("Stream closed");
    * Flush the output buffer to the underlying character stream, without
    * flushing the stream itself. This method is non-private only so that it
    * may be invoked by PrintStream.
    void flushBuffer() throws IOException {
         synchronized (lock) {
         ensureOpen();
         if (nextChar == 0)
              return;
         out.write(cb, 0, nextChar);
         nextChar = 0;
    * Write a single character.
    * @exception IOException If an I/O error occurs
    public void write(int c) throws IOException {
         synchronized (lock) {
         ensureOpen();
         if (nextChar >= nChars)
              flushBuffer();
         cb[nextChar++] = (char) c;
    * Our own little min method, to avoid loading java.lang.Math if we've run
    * out of file descriptors and we're trying to print a stack trace.
    private int min(int a, int b) {
         if (a < b) return a;
         return b;
    * Write a portion of an array of characters.
    * <p> Ordinarily this method stores characters from the given array into
    * this stream's buffer, flushing the buffer to the underlying stream as
    * needed. If the requested length is at least as large as the buffer,
    * however, then this method will flush the buffer and write the characters
    * directly to the underlying stream. Thus redundant
    * <code>BufferedWriter</code>s will not copy data unnecessarily.
    * @param cbuf A character array
    * @param off Offset from which to start reading characters
    * @param len Number of characters to write
    * @exception IOException If an I/O error occurs
    public void write(char cbuf[], int off, int len) throws IOException {
         synchronized (lock) {
         ensureOpen();
    if ((off < 0) || (off > cbuf.length) || (len < 0) ||
    ((off + len) > cbuf.length) || ((off + len) < 0)) {
    throw new IndexOutOfBoundsException();
    } else if (len == 0) {
    return;
         if (len >= nChars) {
              /* If the request length exceeds the size of the output buffer,
              flush the buffer and then write the data directly. In this
              way buffered streams will cascade harmlessly. */
              flushBuffer();
              out.write(cbuf, off, len);
              return;
         int b = off, t = off + len;
         while (b < t) {
              int d = min(nChars - nextChar, t - b);
              System.arraycopy(cbuf, b, cb, nextChar, d);
              b += d;
              nextChar += d;
              if (nextChar >= nChars)
              flushBuffer();
    * Write a portion of a String.
    * <p> If the value of the <tt>len</tt> parameter is negative then no
    * characters are written. This is contrary to the specification of this
    * method in the {@linkplain java.io.Writer#write(java.lang.String,int,int)
    * superclass}, which requires that an {@link IndexOutOfBoundsException} be
    * thrown.
    * @param s String to be written
    * @param off Offset from which to start reading characters
    * @param len Number of characters to be written
    * @exception IOException If an I/O error occurs
    public void write(String s, int off, int len) throws IOException {
         synchronized (lock) {
         ensureOpen();
         int b = off, t = off + len;
         while (b < t) {
              int d = min(nChars - nextChar, t - b);
              s.getChars(b, b + d, cb, nextChar);
              b += d;
              nextChar += d;
              if (nextChar >= nChars)
              flushBuffer();
    * Write a line separator. The line separator string is defined by the
    * system property <tt>line.separator</tt>, and is not necessarily a single
    * newline ('\n') character.
    * @exception IOException If an I/O error occurs
    public void newLine() throws IOException {
         write(lineSeparator);
    * Flush the stream.
    * @exception IOException If an I/O error occurs
    public void flush() throws IOException {
         synchronized (lock) {
         flushBuffer();
         out.flush();
    * Close the stream.
    * @exception IOException If an I/O error occurs
    public void close() throws IOException {
         synchronized (lock) {
         if (out == null)
              return;
         flushBuffer();
         out.close();
         out = null;
         cb = null;
    What Flush(); does
    Example, you have a file called c, your writer is b and buffereredwriter is a. so your programs calls a, a talks to b, and b talks to c. when you call the Flush method, the information is sent to the outfile which is c immediately before you even close the file, because when you write to the file, it does not write directly, it writes to a buffer, so flush actually causes the buffer to write to file. Also if you call the close method on that file without the flush, the buffer will still get flushed.
    consider BufferedWriter c = new BufferedWriter(new PrintWriter("c:\\c"));
    you wrap printwriter into a buffered writer, now if you close this "connection" to the file, the buffer will get flushed, noting that all the data is sitting in the buffered and not yet in the file, and this happens if something dont break...

  • ORA-06502: PL/SQL: numeric or value error: character string buffer too smal

    Hi Guys I am getting error ORA-06502: PL/SQL: numeric or value error: character string buffer too small as it said i thought it would be issue with length of feild but i tried to change is nothihg work i am posing code here if any one can please help me on this
    PROCEDURE REPORT
    p_rpt_from_dt in varchar2,
    p_rpt_to_dt in varchar2,
    p_apvr_id in tc_wkr.tc_row_id%type default NULL,
    p_rpt_type in varchar2 default NULL,
    p_backto_pg in varchar2 default NULL
    IS
    v_rpt_from_dt date := var_to_date(p_rpt_from_dt);
    v_rpt_to_dt date := var_to_date(p_rpt_to_dt);
    v_time_str varchar2(15);
    cursor period_cur
    cp_from_dt date,
    cp_to_dt date
    is
    select beg_dt, end_dt
    from jmcs_wk_tprd
    where beg_dt <= cp_to_dt -- report end date
    and end_dt >= cp_from_dt -- report start date
    BEGIN
    if sys_security('tcsys', 'tc_reports') != 'GRANTED' then
    apps_main.access_denied;
    return;
    end if;
    if lg_debug_fl then
    v_time_str := to_char(lg_sysdate, 'hh:mi:ss a.m.');
    else
    v_time_str := tc_time(lg_sysdate);
    end if;
    /* get the time card time periods applicable to the report */
    lga_tc_strt_dt := lga_null_date;
    for recs in period_cur(v_rpt_from_dt, v_rpt_to_dt) loop
    lga_tc_strt_dt(lga_tc_strt_dt.count+1) := recs.beg_dt;
    lga_tc_end_dt(lga_tc_end_dt.count+1) := recs.end_dt;
    end loop;
    --if p_apvr_id is NULL then
    if p_rpt_type != 'D' then
    tc_reporting.reports_header
    1,
    'Time Card Status Report',
    'for '||dd_mon_yyyy(v_rpt_from_dt)||' through '||dd_mon_yyyy(v_rpt_to_dt)||'<BR>'||
    'Report Date: '||dd_mon_yyyy(lg_sysdate)||' Time: '||v_time_str,
    NULL,
    NULL,
    NULL,
    'javascript:window.close()', /* Backto */
    'alert(''Reminder! Click on logo when you are ready to return to previous page'')'
    end if;
    if p_apvr_id is NULL then
    sub_STATUS_BD_ALPHA (v_rpt_from_dt, v_rpt_to_dt, TRUE, p_rpt_type, p_apvr_id);
    else
    htp.p('<!-- Selected Approver ('||p_apvr_id||') -->');
    sub_STATUS_BD_APVR (v_rpt_from_dt, v_rpt_to_dt, p_rpt_type, p_apvr_id);
    end if;
    htp.p('</body></html>');
    EXCEPTION
    WHEN OTHERS THEN
    error_proc(SQLERRM, SQLCODE, owa_util.get_cgi_env('PATH_INFO'));
    htp.p('Error Code is :'||SQLERRM);
    END REPORT;
    This package in trun call other procedure like below
    PROCEDURE sub_STATUS_BD_ALPHA
    p_rpt_from_dt in date,
    p_rpt_to_dt in date,
    p_display_hdr in boolean,
    p_rpt_type in varchar2 default 'B',
    p_apvr_id in tc_wkr.tc_row_id%type default NULL,
    p_tcs_user_id in tc_wkr.tc_row_id%type default NULL
    IS
    v_time_str varchar2(15);
    v_apvr_id tc_wkr.tc_row_id%type := 0;
    v_a_user_id tc_wkr.tc_row_id%type; -- approver tcs_user_id
    v_cnt integer := 0;
    v_people_cnt integer := 0;
    v_stat_cd varchar2(2000);
    v_display_fl boolean := FALSE;
    /*===========================================================================*/
    cursor people_cur
    cp_from_dt in date,
    cp_to_dt in date
    is
    select
    d_full_nm_lfm as name,
    tc_row_id as tcs_user_id,
    tcw_typ as pay_typ,
    tcw_id as pay_id,
    sys_strt_date as sys_strt_dt,
    sys_end_dt
    from tc_wkr
    where sys_strt_date <= cp_to_dt
    and nvl(sys_end_dt, cp_to_dt) >= cp_from_dt
    order by upper(d_full_nm_lfm);
    /* find the current or the most recent (if no current) approver */
    cursor apvr_cur
    cp_tcs_user_id in tc_wkr.tc_row_id%type
    is
    select
    a.f_tc_apvr_id as fk_tcs_apvr_id,
    w.d_full_nm_lfm as apvr_name,
    w.tcw_typ as apvr_pay_typ,
    w.tcw_id as apvr_pay_id,
    a.strt_dt,
    a.end_dt
    from tc_wkr w, tc_ap_asmt a
    where a.f_tc_wkr_id = cp_tcs_user_id
    and w.tc_row_id = a.f_tc_apvr_id
    order by a.strt_dt desc;
    /* list of existing time cards UNION required time cards */
    cursor tc_cur
    cp_tcs_user_id in tc_wkr.tc_row_id%type, /* who's time cards */
    cp_from_dt in date, /* report period from date */
    cp_to_dt in date /* report period to date */
    is
    select
    stat_cd,
    strt_dt,
    end_dt
    from tc
    where strt_dt <= cp_to_dt
    and end_dt >= cp_from_dt
    and fk_tc_wkrtcw_id = cp_tcs_user_id
    UNION
    select
    'Required' as stat_cd,
    beg_dt as strt_dt,
    end_dt
    from jmcs_wk_tprd
    where beg_dt <= cp_to_dt
    and end_dt >= cp_from_dt
    and beg_dt not in (
    select strt_dt
    from tc
    where strt_dt <= cp_to_dt
    and end_dt >= cp_from_dt
    and fk_tc_wkrtcw_id = cp_tcs_user_id
    order by strt_dt;
    BEGIN
    if lg_debug_fl then
    v_time_str := to_char(lg_sysdate, 'hh:mi:ss a.m.');
    else
    v_time_str := tc_time(lg_sysdate);
    end if;
    if p_apvr_id > 0 then
    lga_report_out := lga_report_out_null;
    v_apvr_id := p_apvr_id;
    lga_apvr := lga_apvr_null;
    select
    d_full_nm_lfm,
    tc_row_id,
    tcw_id,
    tcw_typ
    into
    lga_apvr(1).apvr_name,
    lga_apvr(1).apvr_tcs_id,
    lga_apvr(1).apvr_pay_id,
    lga_apvr(1).apvr_pay_typ
    from tc_wkr
    where tc_row_id = v_apvr_id;
    if lga_apvr(1).apvr_pay_typ != 'S' then
    select decode(bend_empl_fl, 'Y', 'E', 'W')
    into lga_apvr(1).apvr_pay_typ
    from empl
    where empl_id = lga_apvr(1).apvr_pay_id;
    end if;
    end if;
    if p_display_hdr then
    if lga_tc_strt_dt.count > 6 then /* more than 6 time periods (1 month) */
    lga_width(1) := to_char(.15 * lg_page_width_standard);
    lga_width(2) := to_char(.08 * lg_page_width_standard);
    for i in 1..lga_tc_strt_dt.count loop
    lga_width(lga_width.count+1) := to_char(.09 * lg_page_width_standard);
    end loop;
    lg_page_width_standard := to_number(lga_width(1)) + to_number(lga_width(2));
    if nvl(p_apvr_id, 0) = 0 then
    lg_page_width_standard := lg_page_width_standard * 2;
    end if;
    htp.p('<!-- page width = '||lg_page_width_standard||'-->');
    for i in 3..lga_width.count loop
    lg_page_width_standard := lg_page_width_standard + to_number(lga_width(i));
    htp.p('<!-- page width = '||lg_page_width_standard||'-->');
    end loop;
    lg_page_width := to_char(lg_page_width_standard);
    else
    lga_width(1) := '15%';
    lga_width(2) := '8%';
    lga_width(3) := '9%';
    lga_width(4) := '9%';
    lga_width(5) := '9%';
    lga_width(6) := '9%';
    lga_width(7) := '9%';
    lga_width(8) := '9%';
    end if;
    sub_DETAIL_PAGE_HD(p_apvr_id);
    end if;
    /* cursor loop */
    for p in people_cur(p_rpt_from_dt, p_rpt_to_dt) loop
    /* is/was this person assigned to the selected approver for the report period */
    v_display_fl := FALSE;
    if nvl(p_tcs_user_id, 0) > 0 then
    if p_tcs_user_id = p.tcs_user_id then
    htp.p('<br>Selected User');
    v_display_fl := TRUE;
    end if;
    elsif nvl(p_apvr_id, 0) = 0 then
    if nvl(p_apvr_id, 0) = 0 then
    v_display_fl := TRUE;
    elsif p_apvr_id > 0 or p_apvr_id = -1 then
    v_display_fl := fct_ASSIGNED_APVR(p.tcs_user_id, p_apvr_id, p_rpt_from_dt, p_rpt_to_dt);
    end if;
    if v_display_fl then
    v_people_cnt := v_people_cnt + 1;
    lg_tcs_owner_info.USER_ID := p.tcs_user_id;
    lg_tcs_owner_info.PAY_ID := p.pay_id;
    lg_tcs_owner_info.PAY_TYPE := p.pay_typ;
    lg_tcs_owner_info.SYS_STRT_DT := p.sys_strt_dt;
    lg_tcs_owner_info.TERM_DT := p.sys_end_dt;
    if p.pay_typ = 'S' then
    begin
    select wrk_hire_dt
    into lg_tcs_owner_info.hire_dt
    from subcntr
    where sub_id = p.pay_id;
    exception
    when no_data_found then
    tc_debug.html_message('subcntr.pay_id('||p.pay_id||')');
    end;
    else
    select
    wrk_hire_dt,
    decode(bend_empl_fl, 'Y', 'E', 'W')
    into
    lg_tcs_owner_info.hire_dt,
    lg_tcs_owner_info.pay_type
    from empl
    where empl_id = lg_tcs_owner_info.PAY_ID;
    end if;
    if lga_report_out.count = 0 then
    lga_report_out(lga_report_out.count+1) := '<table border="1" cellpadding="3" width="'||lg_page_width||'">';
    end if;
    if mod(v_people_cnt,2) = 1 then
    lga_report_out(lga_report_out.count+1) := ('<tr bgcolor="'||lg_odd_bgcolor||'">');
    else
    lga_report_out(lga_report_out.count+1) := ('<tr bgcolor="'||lg_even_bgcolor||'">');
    end if;
    lga_report_out(lga_report_out.count+1) := ('<td valign="top"><font size=-2>'||p.name||'</font></td >');
    lga_report_out(lga_report_out.count+1) := ('<td valign="top"><font size=-2>'||p.pay_typ||'-'||lpad(p.pay_id,4,'0')||'</font></td >');
    if nvl(p_apvr_id, 0) > 0 then /* Single Approver */
    /* need approver ID for time card "status" */
    lga_apvr := lga_apvr_null; /* clear the approver id array */
    lga_apvr(1).apvr_tcs_id := p_apvr_id;
    elsif nvl(p_apvr_id, 0) = 0 then /* ALL Approvers */
    lga_apvr := lga_apvr_null; /* clear the approver id array */
    v_cnt := 0;
    for ap in apvr_cur (p.tcs_user_id) loop
    if v_cnt = 0 then
    /* most recent approver may not be the applicable approver */
    v_cnt := 1;
    lga_apvr(v_cnt).apvr_name := ap.apvr_name; -- identify multiple approvers for the "status"
    lga_apvr(v_cnt).apvr_tcs_id := ap.fk_tcs_apvr_id; -- identify multiple approvers for the "status"
    lga_apvr(v_cnt).apvr_pay_id := ap.apvr_pay_id; -- identify multiple approvers for the "status"
    v_apvr_id := ap.fk_tcs_apvr_id;
    if ap.apvr_pay_typ = 'S' then
    lga_apvr(v_cnt).apvr_pay_typ := ap.apvr_pay_typ; -- identify multiple approvers for the "status"
    else
    select decode(bend_empl_fl, 'Y', 'E', 'W')
    into lga_apvr(1).apvr_pay_typ
    from empl
    where empl_id = lga_apvr(1).apvr_pay_id;
    end if;
    end if;
    if ap.strt_dt <= p_rpt_to_dt and nvl(ap.end_dt, p_rpt_to_dt) >= p_rpt_from_dt then
    /* approver record */
    lg_tcs_owner_info.APVR_ID := ap.fk_tcs_apvr_id;
    lg_tcs_owner_info.APVR_STRT_DT := ap.strt_dt;
    lg_tcs_owner_info.APVR_END_DT := ap.end_dt;
    don't enter same approver name multiple times
    when same approver has been assigned more than once
    Example: approver1, approver_2, approver_1 (change back to approver 1)
    for i in 1..lga_apvr.count loop
    v_apvr_id := ap.fk_tcs_apvr_id;
    if lga_apvr(i).apvr_tcs_id = ap.fk_tcs_apvr_id then
    /* don't add again */
    v_apvr_id := NULL;
    exit;
    end if;
    end loop;
    if v_apvr_id is not NULL then
    v_cnt := v_cnt + 1;
    lga_apvr(v_cnt).apvr_name := ap.apvr_name; -- identify multiple approvers for the "status"
    lga_apvr(v_cnt).apvr_tcs_id := ap.fk_tcs_apvr_id; -- identify multiple approvers for the "status"
    lga_apvr(v_cnt).apvr_pay_id := ap.apvr_pay_id; -- identify multiple approvers for the "status"
    lga_apvr(v_cnt).apvr_pay_typ := ap.apvr_pay_typ; -- identify multiple approvers for the "status"
    end if;
    end if;
    end loop;
    /* list approver pay IDs */
    lga_report_out(lga_report_out.count+1) := ('<td valign="top"><font size=-2>');
    if lga_apvr.count = 0 then
    lga_report_out(lga_report_out.count+1) := 'Approver Unassigned';
    else
    for i in 1..lga_apvr.count loop
    if i > 1 then
    lga_report_out(lga_report_out.count+1) := '<br>';
    end if;
    lga_report_out(lga_report_out.count+1) := (lga_apvr(i).apvr_name);
    end loop;
    end if;
    lga_report_out(lga_report_out.count+1) := ('<td valign="top"><font size=-2>');
    if lga_apvr.count = 0 then
    lga_report_out(lga_report_out.count+1) := 'N/A';
    else
    for i in 1..lga_apvr.count loop
    if i > 1 then
    lga_report_out(lga_report_out.count+1) := '<br>';
    end if;
    lga_report_out(lga_report_out.count+1) := (lga_apvr(i).apvr_pay_typ)||'-'||lpad(lga_apvr(i).apvr_pay_id,4,'0');
    end loop;
    end if;
    lga_report_out(lga_report_out.count+1) := ('</font></td >');
    end if;
    for t in tc_cur(p.tcs_user_id, p_rpt_from_dt, p_rpt_to_dt) loop
    htp.p('<! '||t.strt_dt||', '||t.end_dt||', '||t.stat_cd||' -->');
    --lga_report_out(lga_report_out.count+1) := ('<td valign="top"><font size=-2>');
    --lga_report_out(lga_report_out.count+1) := (t.stat_cd);
    --lga_report_out(lga_report_out.count+1) := ('</font></td >');
    /* has the selected approver has completed processing */
    if p_apvr_id > 0
    and v_apvr_id = p_apvr_id
    and v_a_user_id != p_apvr_id
    then
    exit;
    end if;
    for ap in apvr_cur (p.tcs_user_id) loop
    if apvr_cur%rowcount = 1 then
    /* most recent approver assigned */
    lg_tcs_owner_info.apvr_id := ap.fk_tcs_apvr_id;
    end if;
    if ap.strt_dt <= t.end_dt and nvl(ap.end_dt, t.end_dt) >= t.strt_dt then
    /* approver assigned during time card period */
    lg_tcs_owner_info.apvr_id := ap.fk_tcs_apvr_id;
    exit;
    end if;
    end loop;
    lg_tc_status.strt_dt := t.strt_dt;
    lg_tc_status.end_dt := t.end_dt;
    lg_tc_status.stat_cd := t.stat_cd;
    v_stat_cd := fct_TC_STATUS(nvl(p_apvr_id, 0));
    lga_report_out(lga_report_out.count+1) := ('<td align="center" valign="top" bgcolor="'||lg_tc_status.bg_color||'">');
    lga_report_out(lga_report_out.count+1) := ('<font size=-2 color='||lg_tc_status.font_color||'>');
    lga_report_out(lga_report_out.count+1) := v_stat_cd;
    lga_report_out(lga_report_out.count+1) := ('</font></td >');
    end loop;
    lga_report_out(lga_report_out.count+1) := '</tr>';
    end if; /* v_display_fl */
    end loop;
    if p_rpt_type in ('B', 'S') then
    lg_page_cnt := lg_page_cnt + 1;
    sub_DISPLAY_STATUS_SUMMARY;
    end if;
    if lga_report_out.count > 0 then
    lga_report_out(lga_report_out.count+1) := '</table>';
    end if;
    if lga_report_out.count > 0 then
    if p_rpt_type = 'B' or p_apvr_id > 0 then
    if p_display_hdr then
    if lg_page_cnt > 0 then
    if p_apvr_id > 0 then /* selected individual approver */
    htp.p('</table>');
    end if;
    htp.p('<br style="page-break-after:always">');
                        htp.p('<!-- &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& -->');
                        htp.p('<!-- &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& -->');
    end if;
    lg_page_cnt := lg_page_cnt + 1;
    tc_reporting.reports_header
    1,
    'Time Card Status Report',
    'for '||dd_mon_yyyy(p_rpt_from_dt)||' through '||dd_mon_yyyy(p_rpt_to_dt)||'<BR>'||
    'Report Date: '||dd_mon_yyyy(lg_sysdate)||' Time: '||v_time_str,
    NULL,
    NULL,
    NULL,
    NULL, -- p_backto_pg, /* Backto */
    'focus()',
    lg_page_cnt
    end if;
    end if;
    if p_rpt_type in ('B', 'D') then
    for i in 1..lga_report_out.count loop
    htp.p(lga_report_out(i));
    end loop;
    end if;
    end if;
    END sub_STATUS_BD_ALPHA;
    Some veriable
    type report_tc_rec is record
    tc_owner_name tc_wkr.d_full_nm_lfm%type,
    o_user_id tc_wkr.tc_row_id%type,
    o_pay_id varchar2(10),
    o_sys_strt_dt date,
    o_sys_end_dt date,
    tc_apvr_name tc_wkr.d_full_nm_lfm%type,
    a_pay_id varchar2(10),
    a_user_id tc_wkr.tc_row_id%type,
    tc_strt_dt date,
    tc_end_dt date,
    tc_stat_cd varchar2(50),
    ap_strt_dt date,
    ap_end_dt date
    /* time card owner information */
    TYPE tcs_owner_info_rec IS RECORD
    USER_ID tc_wkr.tc_row_id%type,
    PAY_ID tc_wkr.tcw_id%type,
    PAY_TYPE tc_wkr.tcw_typ%type,
    HIRE_DT date,
    SYS_STRT_DT date,
    TERM_DT date,
    APVR_ID tc_wkr.tc_row_id%type,
    APVR_STRT_DT date,
    APVR_END_DT date
    /* status code determines report cell font and background colors */
    TYPE tc_status_rec IS RECORD
    STRT_DT date,
    END_DT date,
    STAT_CD tc.stat_cd%type,
    FONT_COLOR varchar2(16),
    BG_COLOR varchar2(16)
    /* count of all time card status for report summary */
    TYPE tc_status_summary_rec IS RECORD
    APPROVED_CNT integer := 0,
    REJECTED_CNT integer := 0,
    SUBMITTED_CNT integer := 0,
    POSTED_CNT integer := 0,
    VERIFIED_CNT integer := 0,
    OPEN_CNT integer := 0,
    NEW_CNT integer := 0,
    REQUIRED_CNT integer := 0,
    TOTAL_CNT integer := 0
    /* determine multiple approvers for individual for selected report period */
    TYPE apvr_rec IS RECORD
    apvr_name tc_wkr.d_full_nm_lfm%type,
    apvr_tcs_id tc_wkr.tc_row_id%type,
    apvr_pay_id tc_wkr.tcw_id%type,
    apvr_pay_typ tc_wkr.tcw_typ%type
    TYPE apvr_id_array_table IS TABLE OF apvr_rec
    index by binary_integer;
    type output_array is table of varchar2(1000)
    index by binary_integer;
    type date_array is table of date
    index by binary_integer;
    type status_array is table of varchar2(1000)
    index by binary_integer;
    type apvr_array is table of number(8)
    index by binary_integer;
    lga_report_out output_array; /* array of HTML code to be output to browser */
    lga_report_out_null output_array; /* null array of HTML code */
    lga_tc_status status_array;
    lga_null_status status_array;
    lga_tc_strt_dt date_array;
    lga_tc_end_dt date_array;
    lga_tc_disp date_array; /* start dates of displayed TC for selected user */
    lga_null_date date_array; /* null array used to clear other date arrays */
    /* LOCAL GLOBAL VARIABLES */
    lg_tcs_owner_info tcs_owner_info_rec; /* time card owner information */
    lg_tc_status tc_status_rec; /* time card status information */
    lg_tc_status_summary tc_status_summary_rec; /* time card count by status */
    lg_tc_rec report_tc_rec; /* time card */
    lga_apvr apvr_id_array_table; /* array of approver Names and Payroll IDs */
    lga_apvr_null apvr_id_array_table; /* clear the lga_apvr array for each user */
    lg_sysdate date := sysdate;
    lg_debug_fl boolean := FALSE;
    lg_debug_owner_id tc_wkr.tc_row_id%type := 9905;
    lg_debug_apvr_id tc_wkr.tc_row_id%type := 1000;
    The chnages i have done its in bold
    Please Advice
    Thanks
    Edited by: Purvik on Aug 25, 2009 11:59 AM

    There is not a chance in the world, especially not knowing column definitions that I, and I suspect most anyone else, is going to wade through this much unformated code looking for an error you couldn't bother to copy in full.
    Either tell us, specifically, the line on which the error is occurring or, better yet, start whacking stuff out of your code until you find the offending definition. That is certainly what I would do. Commenting out sections is a marvelous way to quickly find an issue.
    Before you post again please read the FAQ. It will explain to you how to properly post and use the tags.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for