Netbean variable declaration help

I've been trying to crank out yet another mortgage program. The problem I have is with the declaration of the following
double loan = Double.parseDouble(loanField.getText());
double rate = Double.parseDouble(rateField.getText());
double years_due = Double.parseDouble(years_dueField.getText());
I'm not quite certain if it's the declaration itself, or if I didn't set up the GUI properly. I've been tinkering with this for 3 days so I figured I'd ask for help. I can't seem to find a post that suitably answers my question. Any help would be appreciated. Here is the code. I'm using Netbean IDE 6.0.1 if that is of any use to you.
* week2_herbieGUI.java
* Created on August 1, 2008, 6:45 PM
* @author  archon
public class week2_herbieGUI extends javax.swing.JFrame {
    /** Creates new form week2_herbieGUI */
    public week2_herbieGUI() {
        initComponents();
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {
        loanfield = new javax.swing.JTextField();
        ratefield = new javax.swing.JTextField();
        years_duefield = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        PaymentLabel = new javax.swing.JLabel();
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("PaymentCalculatorGUI");
        loanfield.setName("loanField"); // NOI18N
        ratefield.setText("jTextField2");
        ratefield.setName("rateField"); // NOI18N
        years_duefield.setName("years_dueField"); // NOI18N
        jLabel1.setText("Principle Loan");
        jLabel1.setName("Principle Loan"); // NOI18N
        jLabel2.setText("Interest Rate");
        jLabel2.setName("Interest Rate"); // NOI18N
        jLabel3.setText("Years of Mortgage");
        jLabel3.setName("Years of Mortgage"); // NOI18N
        jButton1.setText("Calculate");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
        PaymentLabel.setText("Monthly Payment");
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jButton1)
                        .addGap(31, 31, 31)
                        .addComponent(PaymentLabel))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(jLabel2)
                            .addComponent(jLabel3))
                        .addGap(25, 25, 25)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(ratefield, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
                            .addComponent(loanfield)
                            .addComponent(years_duefield, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(180, Short.MAX_VALUE))
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(loanfield, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(ratefield, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(years_duefield, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(26, 26, 26)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1)
                    .addComponent(PaymentLabel))
                .addContainerGap(25, Short.MAX_VALUE))
        pack();
    }// </editor-fold>
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
      //gather necessary variables from user
        double loan = Double.parseDouble(loanField.getText());
        double rate = Double.parseDouble(rateField.getText());
        double years_due = Double.parseDouble(years_dueField.getText());
      //Variables derived from user input
        double rate_total = rate/100; //Converts interest rate to decimal form
        double rate_monthly = rate_total/12; //converts to monthly interest rate
        double payment_year = years_due * 12; //Number of payments during course of mortgage.
        double payment = (loan * rate_monthly) / (1 - Math.pow(1 + rate_monthly, - payment_year)); //Calculates monthly payment
        PaymentLabel.setText("Your monthly payment is $" +payment);
     * @param args the command line arguments
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new week2_herbieGUI().setVisible(true);
    // Variables declaration - do not modify
    private javax.swing.JLabel PaymentLabel;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JTextField loanfield;
    private javax.swing.JTextField ratefield;
    private javax.swing.JTextField years_duefield;
    // End of variables declaration
}

ThousandSon wrote:
Here is what the computer says:
Cannot find symbol
symbol: variable loanField
location: class week2_herbieGUI
Cannot find Symbol
Symbol: method getText()
location: class loanField
And it says the same thing for rateField and years_dueFieldThank you for finally posting the error message--it didn't hurt a bit did it. Had you posted it in the first place you would have had your answer 6 posts ago and probably a lot more planely.
Please take special note of how this autocode has been generated and especially close attention to naming conventions:
    // Variables declaration - do not modify
    private javax.swing.JLabel PaymentLabel;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JTextField loanfield;
    private javax.swing.JTextField ratefield;
    private javax.swing.JTextField years_duefield;
    // End of variables declarationThere in lay your problems, please look this block of code over very carefully and compare it to the errors you are getting and the code you have cut based on this autocode.
Look very very closely. The same error exists in every one of your problems. If that doesn't do it for you, then you can look in the initComponents method and how each of these variables are referenced there. Do you see the difference? (Hint: it is the error.)
BTW: does it show that I really despise when someone chooses to use autogenerated code and then asks how to correct errors from using it--and especially when they don't want to give the exact errors so we don't have to fish through all of the autocode to find out what is happening?

Similar Messages

  • Why can't i edit the variable declaration in Netbeans GUI Applications?

    When i drag and drop jbutton,jlabel and other tools from toolbox on the jform the code is
    automatically generated by the Netbeans.
    At bottom the variable declaration for the jbutton and for the other tools is automatically
    generated.
    The part of that declaration is shaded as grey.
    Is it possible to edit those variables from Netbeans?

    Yup, as Chuck states, it is possible to edit that region of code, since the file is nothing more than a text file, but doing so "breaks" the code so that you cannot modify the GUI content in NetBeans WYSIWYG form editor. Please note, that there are ways of changing the characteristics of those variables without editing them directly. You should look into how to change properties of your GUI with NetBeans. The online tutorials can show you how.

  • Using a static variable declared in an applet in another class

    Hi guys,
    I created an applet and i want to use one of the static variables declared in teh applet class in another class i have. however i get an error when i try to do that...
    in my Return2 class i try to call the variable infoPanel (declared as a static JPanel in myApplet...myApplet is set up like so:
    public class myApplet extends JApplet implements ActionListener, ListSelectionListener
    here are some of the lines causing a problem in the Return2 class:
    myApplet.infoPanel.removeAll();
    myApplet.infoPanel.add(functionForm2.smgframeold);
    myApplet.infoPanel.validate();
    myApplet.infoPanel.repaint();
    here are some of the errors i get
    dummy/Return2.java [211:1] package myApplet does not exist
    myApplet.infoPanel.removeAll();
    ^
    dummy/Return2.java [212:1] package myApplet does not exist
    myApplet.infoPanel.add(functionForm2.smgframeold);
    ^
    dummy/Return2.java [213:1] package myApplet does not exist
    myApplet.infoPanel.validate();
    ^
    dummy/Return2.java [214:1] package myApplet does not exist
    myApplet.infoPanel.repaint();
    ^
    please help! thanks :)

    I don't declare any packages though....i think it just doesn't recognize myApplet for some reason..
    other errors i got compiling are:
    dummy/Return2.java [82:1] cannot resolve symbol
    symbol : variable myApplet
    location: class Return2
    updateDesc.setString(3, myApplet.staticName);
    I Don't get why i'm getting this error cuase they worked fine when myApplet was a standalone application, not an applet.
    myApplet is in the same folder as Return2 and it compiles properly.

  • Variable declaration in BEx - Business scenario's

    Hi,
        I need some documents about all kind of variable declaration with some example business scenarios in MM, FI-CO modules.
    will assign you a reasonable points
    Regards,
    Pooja.S

    Hi Pooja,
    The processing type of a variable may be varies from business requirement.
    In general we will use the processing type:
    Replacement Path : If you specify a variable as a characteristic value, you do not have to specify a text for the characteristic value right away. Instead, you can fill the text field dynamically and specifically for the characteristic that you use for the variable when you execute the query. To do this, define a text variable with automatic replacement.
    [http://help.sap.com/saphelp_nw70/helpdata/EN/bd/589b3c494d8e15e10000000a114084/content.htm]
    Authorisations: If the user belongs to Asia PAciffic region and he must see only details of his region then we can create a variable Region vt Processing type Authorisations so that he vl able to see only that region's data.
    [http://help.sap.com/saphelp_nw70/helpdata/EN/44/599b3c494d8e15e10000000a114084/content.htm]
    SAP EXIT: If you want to define a query that only ever displays the data from the current month, drag the delivered variable “current month” (technical name 0CMONTH) for the characteristic “calendar year/month” (technical name 0CMONTH) into the query filter.
    [http://help.sap.com/saphelp_nw70/helpdata/EN/f1/0a5702e09411d2acb90000e829fbfe/content.htm]
    Customer Exit: You want to use one characteristic value to calculate a second characteristic value. The InfoProvider only contains the calendar day. However, you now also want to display the cumulated value for the relevant period (beginning with the first day of a quarter) in a query.
    For the first day of the quarter, use a variable with customer exit processing. If you now enter the current calendar day (for example, 06/19/2000), a start date of 06/01/2000 appears in the customer exit, and the cumulated value of this period can be displayed.
    [http://help.sap.com/saphelp_nw70/helpdata/EN/f1/0a56f5e09411d2acb90000e829fbfe/content.htm]
    I hope this helps you.

  • URGENT: problem with variable-declaration while precompiling

              Hi,
              i got a problem while precompiling my webapplication.
              i got some jsp-pages, each containing following code
              <%@ include file="/header.jsp" %>
              <% button = true; %>
              [...some code...]
              <%@ include file="/footer.jsp" %>
              The variable 'button' is defined in header.jsp and
              evaluated in footer.jsp. When i run through my application without precompiling
              it, there appear NO errors, but when i try to precompile my pages, the jsp-compiler
              reports an error in footer.jsp, because in footer.jsp is the 'button'-Variable
              used, but not defined and not included (because all other pages include footer.jsp)
              How can I tell the jsp-Compiler not to check for variable declarations, or what
              else can i do to work around this problem ?
              thanks,
              Dirk Bade
              

    Thanks for the sample. Changed it to look this way. Still getting the error message from above. Any clue?
    [ BTW: you can see the auto-fixits that Netbeans used to resolve the exception thrown errors from earlier.  Ugly ... I used Netbeans for the ease of interface generation, but I am spending a lot time chasing down little stuff like this. ]
    public class DesktopApplication1View extends FrameView {
        public DesktopApplication1View(SingleFrameApplication app) throws PortInUseException, UnsupportedCommOperationException, IOException, NoSuchPortException {
            super(app);
          initComponents();  //interface code follows this until the variables below ...
            String      defaultPort = "/dev/ttyS0";
            String      portName;
            ByteBuffer  asciiBytes = null;
            CommPort    commPort = null;
            byte[] h = new byte[asciiBytes.capacity()];
            asciiBytes.get(h, 0, h.length);
            CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(defaultPort);
                System.out.println("Default port" + defaultPort + "found.");
            if ( portIdentifier.isCurrentlyOwned() )
                System.out.println("Error: Port is currently in use");
            try {
                 commPort = portIdentifier.open(this.getClass().getName(), 200);
            } catch (NoSuchPortException e) {
            System.out.println("Whoops! Cannot identify the port.");
            }

  • JSP1.2 scripting variable! help!!

    JSP1.2 scripting variable! help!!
    Posted by: Tony Liu on August 18, 2005 @ 03:06 PM
    TOMCAT5/jsp1.2. I am using custom tag to expose a variable�Cthen a jsp script references an object that tag exposes. However, error happens to me always. "variable cannot be resolved". looks it cant expose the variable to jsp page.
    My code:
    TLD file:
    <variable>
    <name-from-attribute>method</name-from-attribute>
    <variable-class>java.lang.String</variable-class>
    <declare>true</declare>
    <scope>AT_BEGIN</scope>
    </variable>
    someTag.java
    pageContext.setAttribute("method",string1);
    somePage.jsp
    <%=method%>
    error:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 90 in the jsp file: /Tony/amvetsform.jsp
    Generated servlet error:
    method cannot be resolved
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:397)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    Who could let me know what's wrong with it? Bug from Tomcat? Or, I missed something to produce a scripting variable for jsp? It was supposed to be easy to expose a variable....
    Thanks in advance.
    Tony

    A bit more info please.
    How are you using this with your tag?
    The code from your JSP with
    - your custom tag being used
    - where it is in relation to your scriptlet expression.
    The "name-from-attribute" means that the name of the created variable is defined by the "method" attribute of your tag.
    <my:tag method="theNameOfMyVariable">
      <%= theNameOfMyVariable %>
    </my:tag>Where do you use the variable in relation to where the tag is?
    Declaring it AT_BEGIN means that it is available from the start tag to the close of any enclosing custom tag.
    It won't be a bug in Tomcat. Always assume it is a problem with your code. 99.99% of the time, that assumption is correct.
    Cheers,
    evnafets

  • Class variable declaration

    Hello.
    Just looking through some code and I see a class variable declared as so...
    static final MessageDigest digestFunction;
    static { // The digest method is reused between instances to provide higher entropy.
            MessageDigest tmp;
            try {
                tmp = java.security.MessageDigest.getInstance(hashName);
            } catch (NoSuchAlgorithmException e) {
                tmp = null;
            digestFunction = tmp;
        }I have never come accoss a variable being declared in this way and it looks strange. The use of static before the opening brace is strange to me, and just the fact that this is not inside the constructor. Would this code be run after or before code inside the class constuctor?
    Thanks for any help, just a little confused!

    Sir_Dori wrote:
    Ah yes, of course it could not be within the constructor as it is static, sorry.
    So when would the class be loaded? Could this be the first time the ClassName.staticBlockVar is accessed, Most likely, yes. The first time something else uses the class. Classloading in Java is lazy.
    Also, is the code not reevaluated every time it is referenced ?No. Only when the class is loaded (actually, when it's initialized, but usually it boils down to the same thing)
    You can write some simple tests for this, by writing a constructor and a static initializer, then instantiating it twice, for example. Don't be afraid to just play around with code to test assumptions. I find JUnit very handy for experimenting with assumptions.

  • I am passing my itab data to variable declared in global declaration.

    Dear All,
                  I am passing my itab data to variable declared in global declaration, i am getting column one data in all eight variables declared. but column two data having 8*10=80 data i.s. for 1 entry of column there is 10 entries of column two of field two ,
    but when i am passing that data to a variable i am getting only 1st entry of column 2 instead of 10 entries, plz help me in solving this query. i am working on Smartform.

    Definetly you will get only one record...
    instead of variable decalre and internal table of type variable definition in the global defination and append the values into it..
    now you will get all the entries which you want..
    Regards
    Satish Boguda

  • Regarding Variables declared i n Subroutine

    Hi All,
      Can any body give me information about how to capture the data types of   Variables declared in Subroutine?

    Hi Aruna,
    You can use the DESCRIBE command and get the data type of the variables used in the subrotuines.
    do a F1 help on DESCRIBE <field> command and you will get more details. DESCRIBE command can be used for tables as well as for the fields.
    Cheers
    VJ

  • Report Variable F4 help performance issue

    Hi,
    I have a BI report on DSO >> Multiprovider.
    When i choose F4 Variable help it takes around 2-3 minutes to display the data for selection.
    Currently XXXX chars is with -- Only Posted Values for Navigation. I have tried the below options but could not see any improvement in variable f4 help performance.
    -- Only Values in Infoprovider
    -- Values In Master Data table
    Could someone please suggest if you have faced the similar issue.
    Thanks
    Ashok

    Hello Ashok,
    Ideally you should never built a report based on a DSO, this is because it stores data at a line item level. The way the filter works is that looks at all records (SIDs) lying in the range of selection in the info provider and then displays the filter pane after it populates the records.
    There can only be 1 check in this case, is to check if your DB statistics are up-to-date. The DB statistics decide if an index is to be used or not. So check for the DSO active table and all related SID tables in transaction DB20. Check the date of creation of the statistics, if it's too much in the past, then the DB does not effectively use the indices and hence it takes time.
    You can use program RSANAORA to recompute the statistics.
    Regards,
    Ansel D'Souza

  • Why can't I move a variable declaration from inside a Sub to the Declarations area?

    I'm writing an app and so far, so good. But I need wider access to an array defined in my "Form_Load" sub.
    Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    ' Assign checkboxes to an array.
    Dim Checkboxes() As CheckBox = {chkThumb01, chkThumb02, chkThumb03, chkThumb04, _
    chkThumb05, chkThumb06, chkThumb07, chkThumb08, chkThumb09, chkThumb10}
    Moving the declaration ("Dim Checkboxes()...") from "Sub frmMain_Load" up into the Declarations space just above it breaks my program. :(
    I tried putting it in a Module and that fails too. The ONLY place it work's is in Form_Load (it's not related to being an array because at least one standard integer variable declaration has this problem too.)
    I have other variables in the Declarations area that work fine (eg: "Dim bolChanges as Boolean"), but for some reason, I can't move others out into what
    should be a more global namespace.
    Anyone know what's going on? Thx.

    No, because this makes no difference.
    Background #1: If you do not write your own constructor (=Sub New), the VB compiler adds a default constructor. It contains a call to Sub InitializeComponent. In this Sub, the controls are created and assigned to chkThumb01 etc. You see it if you type "Sub
    New[Enter]":
    Sub New()
    InitializeComponent()
    End Sub
    Background #2: If you write
    Public Class Test
    Private values As Integer() = {1, 2, 3}
    End Class
    it is identical to
    Public Class Test
    Private values As Integer()
    Sub New()
    values = New Integer() {1, 2, 3}
    End Sub
    End Class
    As you can see, the assignments that you do to fields of the class in the declaration line are actually executed in the constructor (sub new).
    Now put both backgrounds together. Consequently, this code
    Public Class Form1
    Private buttons As Button() = {Button1, Button2, Button3}
    End Class
    is identical to this one:
    Public Class Form1
    Private buttons As Button()
    Sub New()
    buttons = New Button() {Button1, Button2, Button3}
    InitializeComponent()
    End Sub
    End Class
    Obviously, the assignment to variable "buttons" is done before the call to Sub InitializeComponent. At this point, variables Button1, Button2 and  Button3 are still empty (Nothing) because they will be set in Sub InitializeComponent. Consequently,
    the array buttons contains just {Nothing, Nothing, Nothing}
    In opposite, if the array buttons is set in the Load event, Button1, Button2 and Button3 have already been set before, Consequently, the array buttons correctly contains references to the three buttons.
    Armin

  • Source a file containing variable declaration in csh style into Java

    Hi ALL,
    How can java import a plain-text file which contains csh declaration statements, then simultaneously declare as the statements into the java program?
    Below is the example that the plain-text file:
    set test_1 = ('1')
    set test_234 = ('2' '3' '4')
    set test_abc = ('abc')
    Thanks,
    Alex

    I have already started learning Java from the web site of Sun Java. Thanks for your advise.
    However, let me explain more details what I want.
    Now, I have a plain-text file, such as /mnt/source.txt, which contain statement of variable declaration as below
    ====================
    set test_1 = ('1')
    set test_234 = ('2' '3' '4')
    set test_abc = ('abc')
    ====================
    These are the csh statement.
    In csh, we can use command "source [filename]" then the variable test_1, test_234 and test_abc will be declared directly. Right?
    Then, now, I have this plain-text file. Also the csh statement.
    However, I would use Java to declare the variable test_1, test_234 and test_abc from this file.
    Thanks.
    Alex

  • Invalid variable declaration:  object 'TIMESTAMP' must be a type or subtype

    Message 1: ORA-06550: line 91, column 14:
    PL/SQL: ORA-06552: PL/SQL: Compilation unit analysis terminated
    ORA-06553: PLS-488: invalid variable declaration: object 'TIMESTAMP' must be a type or subtype
    ORA-06550: line 89, column 1:
    PL/SQL: SQL Statement ignored
    I'm getting above error message when i'm trying to define one cursor from a table which has a column with data timestamp(3) in a cursor i'm not even using a column with data type timestamp .( this tables i created by importing sybase tables into oracle )
    SELECT to_char(sysdate) -- trunc(act.date_posted)
    INTO v__Data
    from cedb.cr_ar_debit_activity act
    where rownum < 2 ;
    for testing purpose i even removed the cursor and make it shor to above query then also it dosent work and gave the above error . if you know the solution then please let me know . i think i've to do/change database settings but i'm not sure .

    the above code is not working but the following code is working if i open cursor from assiging select to variable , why this is happening .
    DECLARE
         v_A_REPORT_DT VARCHAR2(100);
    ls_sel VARCHAR2(900);
    i INTEGER := 1;
    TYPE dynamic_cur IS REF CURSOR;
    tb_test_cur dynamic_cur ;
    TYPE array_date_type IS TABLE OF DATE INDEX BY PLS_INTEGER;
    v1 array_date_type ;
    BEGIN
         v_A_REPORT_DT := '01-01-2007'/* VARCHAR2(2000) */;
    -- this one is not working
    SELECT to_char(sysdate) -- trunc(act.date_posted)
    INTO v_A_REPORT_DT
    from cedb.cr_ar_debit_activity act
    where rownum < 2 ;
    ls_sel := 'SELECT trunc(act.date_posted)
    from cedb.cr_ar_debit_activity act
    where rownum < 3 ' ;
    OPEN tb_test_cur FOR ls_sel;
    LOOP
    FETCH tb_test_cur INTO v1(i) ;
    EXIT WHEN tb_test_cur%notfound;
    dbms_output.put_line(to_char(v1(i)));
    i := i + 1 ;
    END LOOP;
    CLOSE tb_test_cur;
    END;

  • View of variables declared within a package/procedure

    Does anyone know of a view which holds all the variables declared within a package/function/procedure?
    I can see that _arguments holds the parameters defined.
    PLSQL Developer displays these things in their drop downs, so I assume they are either getting it from a view or have written something which parses the _source view?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Do you mean this ?
    SCOTT@db102 SQL> desc dbms_output
    PROCEDURE DISABLE
    PROCEDURE ENABLE
    Argument Name                  Type                    In/Out Default?
    BUFFER_SIZE                    NUMBER(38)              IN     DEFAULT
    PROCEDURE GET_LINE
    Argument Name                  Type                    In/Out Default?
    LINE                           VARCHAR2                OUT
    STATUS                         NUMBER(38)              OUT
    PROCEDURE GET_LINES
    Argument Name                  Type                    In/Out Default?
    LINES                          TABLE OF VARCHAR2(32767) OUT
    NUMLINES                       NUMBER(38)              IN/OUT
    PROCEDURE GET_LINES
    Argument Name                  Type                    In/Out Default?
    LINES                          DBMSOUTPUT_LINESARRAY   OUT
    NUMLINES                       NUMBER(38)              IN/OUT
    PROCEDURE NEW_LINE
    PROCEDURE PUT
    Argument Name                  Type                    In/Out Default?
    A                              VARCHAR2                IN
    PROCEDURE PUT_LINE
    Argument Name                  Type                    In/Out Default?
    A                              VARCHAR2                IN
    SCOTT@db102 SQL>                                         

  • Tab character in variable declaration

    Hello,
    I have a little problem with declaration of variables in scripts. I get an error when there is a TAB character between the variable name and its data type:
    VARIABLE var_name     number;
    Bind Variable "var_name     number" is NOT DECLARED
    This error occur only when I try it in SQL Developer - other tools accept it. Any suggestions how to get rid of this error?

    Couldn't find any prior bug for this, so I logged it:
    Bug 12409565 - TAB CHARACTER NOT RECOGNIZED AS WHITESPACE IN SQL*PLUS BIND VARIABLE DECLARATION
    It seems limited to SQL*Plus syntax, perhaps just the VARIABLE command, and does not replicate in PL/SQL blocks.
    Adding a blank after the tab works around the error, but won't be enough if the tab remains as part of the variable name.
    -Gary Graham, SQL Developer Team

Maybe you are looking for