Please help me : SUBSTR function in Oracle 6i

Dear all people!
I have a problem with SUBSTR as follow:
my code:
declare
string1 varchar2(300);
string2 varchar2(65);
begin
string1 := ....
string2 := substr(string1,1,60);
end;
when i run program in debug
at command "string2 := substr(string1,1,60);" it raise error ORA-06502;
Please tell me how to assign substr(string1,1,60) to string2 (max length of string2 is 65);
I'm looking to forward to receiving your response!
Thank you very much;

The question was simple:
I am trying to do is bring in anything after the * in the Id column no matter how long the name is before the * but my calculation is way off L:
Here is an example of what my data would look like but what I need it to do:
Id                                                        NEW COLUMN
TNET*231333                                  231333
AMER*29283893.2                       29283893.2
TNEY*21893838                             21893838
Do you know how to create this calculation?
Answer: SUBSTR(id,INSTR(id,'*',1)+1,999)
this was emailed to me from someone on here saying "try to see if this helps" and it did that's why i said thank you.

Similar Messages

  • Please help me, boolean function

    Hello everyone, this is my first post in this forum. I have this function but I cant get it to work because I get this "missing return statement". Im desperate now, I cant figure how to fix it. Please help me.
    public static boolean es(String inst) {                              // Verificador de validez
              int ad=inst.indexOf("ADELANTE");
              int at=inst.indexOf("ATRAS");
              int iz=inst.indexOf("IZQUIERDA");
              int de=inst.indexOf("DERECHA");
              int bo=inst.indexOf("BORRAR");
              int ho=inst.indexOf("HOGAR");
              double numero;
              try {
                   if ((ad==0)&&(inst.charAt(8)==' ')) {
                        numero = Double.parseDouble(inst.substring(9));
                        if (numero>0)
                             return true;
                        else return false;
                   if ((at==0)&&(inst.charAt(5)==' ')) {
                        numero = Double.parseDouble(inst.substring(6));
                        if (numero>0)
                             return true;
                        else return false;
                   if ((iz==0)&&(inst.charAt(9)==' ')) {
                        numero = Double.parseDouble(inst.substring(10));
                        if ((numero>0)&&(numero<360))
                             return true;
                        else return false;
                   if ((de==0)&&(inst.charAt(7)==' ')) {
                        numero = Double.parseDouble(inst.substring(8));
                        if ((numero>0)&&(numero<360))
                             return true;
                        else return false;
                   if (bo==0) return true;
                   if (ho==0) return true;
                   else return false;
              catch (NumberFormatException ex) {
         }The objective of this function is to check if the user entered one of these words: "adelante", "atras", "izquierda" or "derecha" followed by a positive number. Thank you in advance for your help.

    you need to have a return statement at the very end of you method.
    here's a rewrite of what you provided...instead of a bunch of returns everywhere, i set a variable to return. i also put else if statements instead of if since you only want to see if one of the instances exist
    public static boolean es(String inst) {                              // Verificador de validez
              int ad=inst.indexOf("ADELANTE");
              int at=inst.indexOf("ATRAS");
              int iz=inst.indexOf("IZQUIERDA");
              int de=inst.indexOf("DERECHA");
              int bo=inst.indexOf("BORRAR");
              int ho=inst.indexOf("HOGAR");
              double numero;
              boolean answer = false;
              try {
                   if ((ad==0)&&(inst.charAt(8)==' ')) {
                        numero = Double.parseDouble(inst.substring(9));
                        if (numero>0)
                             answer = true;
                        else answer = false;
                   else if ((at==0)&&(inst.charAt(5)==' ')) {
                        numero = Double.parseDouble(inst.substring(6));
                        if (numero>0)
                             answer = true;
                        else answer = false;
                   else if ((iz==0)&&(inst.charAt(9)==' ')) {
                        numero = Double.parseDouble(inst.substring(10));
                        if ((numero>0)&&(numero<360))
                             answer = true;
                        else answer = false;
                   else if ((de==0)&&(inst.charAt(7)==' ')) {
                        numero = Double.parseDouble(inst.substring(8));
                        if ((numero>0)&&(numero<360))
                             answer = true;
                        else answer = false;
                   else if (bo==0) answer = true;
                   else if (ho==0) answer = true;
                   else answer = false;
              catch (NumberFormatException ex) {
    answer = false;
              return answer;
    Message was edited by:
    muzic

  • Instr and substr function in oracle issues

    hi all
    I have an issue to split my filename
    Filename is as below:
    ABCD01_123456789_samplename_13062012_10062012-12-12-12-1.PDF
    my output as below
    Col1          Col2                 col3                 col4            col5             col6
    ABCD01    123456789               samplename            13062012    10062012    10062012-12-12-12-1.PDFcan you please help me to split this using any simple method
    thanks ain advance
    Edited by: A on Jun 12, 2012 8:25 PM
    Edited by: A on Jun 12, 2012 8:25 PM

    >
    can you please help me to split this using any simple method
    >
    You can split the string into rows using the same technique used in this example
    http://nuijten.blogspot.com/2009/07/splitting-comma-delimited-string-regexp.html
    Just replace the ',' with an underscore.
    Then you can convert the rows to columns using LISTAGG like this example
    http://www.oracle-base.com/articles/misc/string-aggregation-techniques.php
    Search the forum for 'rows to columns' and you will find plenty of other alternatives.

  • Please help with some function module

    Dear All,
    We are trying to get data for excise duties based eg. BED, ECS, SECESS in the PO printout. Can anyone please suggest any function module through which excise duty can be calculated. For condition types other than ED we are using function module CALCULATE_TAX_ITEM. Please help.
    Thanks and regards,
    Atanu

    Dear All,
    We are trying to get data for excise duties based eg. BED, ECS, SECESS in the PO printout. Can anyone please suggest any function module through which excise duty can be calculated. For condition types other than ED we are using function module CALCULATE_TAX_ITEM. Please help.
    Thanks and regards,
    Atanu

  • Please help.. Application Express + Oracle E-Business Suite: Integrated application licensing question

    Hi
    We are in the process of developing a business application using application express that works more like an extension of Oracle E-Business Suite. Finding an aswer for following question is critical for our small business to move forward with this product development. Request your help please.
    Background:
    - Our application stored metadata and pl/sql programs in a custom scehema in Oracle E-Busiess Suite.
    - We are using Glassfish to host the application express listener to publish/run our application at the moment (development/testing phase)
    Our understanding and clarifications needed:
    - Our potential client must have an Enterprise level licese on Oracle E-Business Suite in order to allow them to deploy/run our application (3rd party).
    - If our potential clients host our application on Oracle HTTP server (from the same box as the Oracle EBS database) then they dont need additional license. Otherwise, they'll have to buy HTTP Server licenses as well?
    - What is the best tool (economical and production level performances point of view) to host a 3rd party apex application? Glassfish, Http server, Java standalone?
    Please help,
    Kind regards
    Ebby

    Our understanding and clarifications needed:
    - Our potential client must have an Enterprise level licese on Oracle E-Business Suite in order to allow them to deploy/run our application (3rd party).
    - If our potential clients host our application on Oracle HTTP server (from the same box as the Oracle EBS database) then they dont need additional license. Otherwise, they'll have to buy HTTP Server licenses as well?
    - What is the best tool (economical and production level performances point of view) to host a 3rd party apex application? Glassfish, Http server, Java standalone?
    You have to contact your local Oracle Sales Representative for Oracle Licensing as no one else can give you right info and also would suggest you to visit
    http://www.oracle.com/us/corporate/pricing/price-lists/index.html
    thanks

  • Please help regarding method/function sign up validation with mysql jdbc.

    HI guys,
    I am have been fixing this problem for days, hope that someone could help me find the bug on my code.
    I have 3 files:
    1.WithAuth.java - for database jdbc mysql connection
    2.WithAuthMet.java - method that will read any variables that will be passed to it. this method is waiting for two variables, a and b. a for userName and b for userPassword.
    3.WithAuthTest.java - the testing class, this is where i declare my sample control data to test the database connection and query.
    here's the actual codes:
    WithAuth.java
    package com.Auth;
    public class WithAuth {
        static String userName = "root";
        static String userPassword = "";
        static String databaseUrl = "jdbc:mysql://localhost:3306/javatowebservice";
        static String userQuery = "select * from userlogin";
    }WithAuthMet.java
    - this is where the error is and where I messed up.
    package com.Auth;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.Statement;
    public class WithAuthMet extends WithAuth {
        public void connect(String a, String b)throws Exception{       
            //try {
                Class.forName ("com.mysql.jdbc.Driver").newInstance ();               
                Connection conn = DriverManager.getConnection (databaseUrl, userName, userPassword);
                Statement stat = conn.createStatement();   
                String query = userQuery;
                ResultSet result = stat.executeQuery(query);
                System.out.println("Result(s): ");
                  while (result.next ()){
                      int i = result.getInt("userId");
                      String name=result.getString("userName");
                      String password=result.getString("userPassword");
                          //System.out.println("test data:"+a);
                      if(a.equals(name.equals("userName"))&& b.equals(password.equals("userPassword"))){
                                System.out.println("User is Valid");
                            else{
                                System.out.println("You are not a Valid User");
                                System.out.println("test data:"+name);
                                System.out.println("test data:"+password);
                                System.out.println("test data:"+a);
                                System.out.println("test data:"+b);
                      //conn.close();
                   // }catch(Exception e){
                    //System.out.println("Exception is ;"+e);
                    //System.out.println("Exception is ;");
    //                if(a.equals(name.("userName"))
    //                    && password.equals(password.equals("userPassword"))){
    //                    System.out.println("User is Valid");
    //                else{
    //                    System.out.println("You are not a Valid User");
    } WithAuthTest.java
    package com.Auth;
    public class WithAuthTest extends WithAuthMet{
        public static void main(String[] args) throws Exception{
            WithAuthMet CTD = new WithAuthMet();   
            String a = "dan";
            String b = "password";
            //CTD.connect(String name,String password);
            CTD.connect(a, b);
            //return connect;
    }please help.

    yakultyakultyakult wrote:
    WithAuthMet.java
    - this is where the error is and where I messed up.
    package com.Auth;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.Statement;
    public class WithAuthMet extends WithAuth {
    public void connect(String a, String b)throws Exception{       
    //try {
    Class.forName ("com.mysql.jdbc.Driver").newInstance ();               
    Connection conn = DriverManager.getConnection (databaseUrl, userName, userPassword);
    Statement stat = conn.createStatement();   
    String query = userQuery;
    ResultSet result = stat.executeQuery(query);
    System.out.println("Result(s): ");
    while (result.next ()){
    int i = result.getInt("userId");
    String name=result.getString("userName");
    String password=result.getString("userPassword");
    //System.out.println("test data:"+a);
    if(a.equals(name.equals("userName"))&& b.equals(password.equals("userPassword"))){
    System.out.println("User is Valid");
    else{
    System.out.println("You are not a Valid User");
    System.out.println("test data:"+name);
    System.out.println("test data:"+password);
    System.out.println("test data:"+a);
    System.out.println("test data:"+b);
    //conn.close();
    // }catch(Exception e){
    //System.out.println("Exception is ;"+e);
    //System.out.println("Exception is ;");
    //                if(a.equals(name.("userName"))
    //                    && password.equals(password.equals("userPassword"))){
    //                    System.out.println("User is Valid");
    //                else{
    //                    System.out.println("You are not a Valid User");
    This is one line that is wrong
                       if(a.equals(name.equals("userName"))&& b.equals(password.equals("userPassword"))){You have 'a' and 'b which are Strings
    and you are comparing them [using equals()] with the boolean return from another set of equals() invocations.
    String equals boolean will always be false (well, maybe not if the String is "TRUE" or "FALSE" - and you would need some more boilerplate to make that work).

  • Need help for Conversion Function in Oracle

    Hi, Can Any One help me Please.
    I need a Oracle conversion script for converting from decimal to hex. and decimal to datetime.
    Thanks In Advance.

    Hi,
    for the Hex-Number-conversion see:
    [url http://psoug.org/snippet/Convert-Hex-to-Decimal-Decimal-to-Hex_78.htm] self-defined Conversion-Functions
    What number format do you have? YYYMMDD
    Or is there a Date corresponding to 1 and a number n represent the date n-1 days after day 1?
    Please describe further.
    Bye
    stratmo

  • Please help me to find out Oracle iStore 11i?

    I have difficulty to find out the Oracle iStore 11i among the Oracle11i CDs? Is there anyone have successfully installed iStore 11i? Please give me a hint, how to install it and where I can find store manager. Any help will be appreciated!
    Thanks in advance
    wei

    Wei,
    Istore 11I is bundel product with the Oracle Application 11i. You have to fully install Oracle Application 11I then you need to start the set up for iStore. There is a document called "Oracle iSupport Implementation Guide
    A86192-01" you can find it at metalink.oracle.com.
    If you cant find it there pls open a tar with the Oracle support requesting this document.
    Thanks,
    Maher
    null

  • Please help with 'Pricing' function module

    Hi!
    I am trying to use function module 'Pricing' but the table it_komv is still empty even after calling. I am basically trying to print some free of charge items on invoice sapscript and hence I am using 'Pricing' function in the print program. I am passing the below parameters. Please tell me whatelse I need to pass/not to pass.
      wa_komk-mandt = sy-mandt.
          wa_komk-kalsm = vbdkr-kalsm.
          wa_komk-kappl = 'V'.
          wa_komk-waerk = vbdkr-waerk.
         wa_komk-knumv = vbdkr-knumv.
          wa_komk-knuma = vbdkr-knuma.
          wa_komk-vbtyp = vbdkr-vbtyp.
          wa_komk-land1 = vbdkr-land1.
          wa_komk-vkorg = vbdkr-vkorg.
          wa_komk-vtweg = vbdkr-vtweg.
          wa_komk-spart = vbdkr-spart.
          wa_komk-prsdt = vbdkr-erdat.
          wa_komk-kurst = vbdkr-kurst.
          wa_komk-kurrf = vbdkr-kurrf.
          wa_komk-kurrf_dat = vbdkr-kurrf_dat.
          wa_komp-kposn = vbdpr-posnr.
          wa_komp-kursk = vbdpr-kursk.
          wa_komp-kursk_dat = vbdpr-kursk_dat.
          wa_komp-werks = vbdpr-werks.
          CALL FUNCTION 'PRICING'
            EXPORTING
            CALCULATION_TYPE        = 'A'
              comm_head_i             = wa_komk
              comm_item_i             = wa_komp
            PRELIMINARY             = ' '
            NO_CALCULATION          = ' '
         IMPORTING
             comm_head_e             = wa_komk
             comm_item_e             = wa_komp
          TABLES
              tkomv                   = it_komv
            SVBAP                   =
        CHANGING
            REBATE_DETERMINED       = ' '
    Thanks a lot!

    Hi,
    Check this example..
    tables: vbdkr.
    data: s_komk type KOMK.
    data: s_komp type komp.
    data: t_komv like KOMV occurs 0 with header line.
    data: t_komvd like komvd occurs 0 with header line.
    Input
    s_komk-mandt = sy-mandt.
    s_komk-knumv = vbdkr-knumv.
    CALL FUNCTION 'RV_PRICE_PRINT_ITEM'
      EXPORTING
        comm_head_i       = s_komk
        comm_item_i       = s_komp
      tables
        tkomv             = t_komv
        tkomvd            = t_komvd
    You can check the program RVADIN01 for a sample..
    Hope this helps..
    Thanks,
    Naren

  • Help: Left Equivalent function in Oracle?

    Hey can anybody throw somelight on the function which is equal to LEFT in Oracle.
    Left$(patientmemberid, Len(patientmemberid) - 2)
    Thanks

    Maybe:
    with
    names(EName) as
    (select 'sana' from dual union all
    select 'saleem' from dual union all
    select 'aijaz' from dual union all
    select 'mohbat' from dual union all
    select 'aasia' from dual union all
    select 'asad ali' from dual union all
    select 'asif' from dual union all
    select 'aftab' from dual union all
    select 'sagar' from dual union all
    select 'hanif' from dual
    select ename
      from names
    where length(ename) - length(replace(ename,:ch)) = 1Regards
    Etbin
    Edited by: Etbin on 26.7.2012 9:13
    select ename
      from names
    where regexp_count(ename,:ch) = 1

  • Please help regarding the function module 'MESSAGE_TEXT_BUILD'

    hii i am a new employee.
    can anyone please explain wat the following code is doing
    IF sy-subrc = 0.
    l_mstring = t100-text.
    IF l_mstring CS '&1'.
    REPLACE '&1' WITH wa_messtab-msgv1 INTO l_mstring.
    REPLACE '&2' WITH wa_messtab-msgv2 INTO l_mstring.
    REPLACE '&3' WITH wa_messtab-msgv3 INTO l_mstring.
    REPLACE '&4' WITH wa_messtab-msgv4 INTO l_mstring.
    ELSE.
    REPLACE '&' WITH wa_messtab-msgv1 INTO l_mstring.
    REPLACE '&' WITH wa_messtab-msgv2 INTO l_mstring.
    REPLACE '&' WITH wa_messtab-msgv3 INTO l_mstring.
    REPLACE '&' WITH wa_messtab-msgv4 INTO l_mstring.
    ENDIF.
    CONDENSE l_mstring.
    i am supposed to use a function module for it
    i have got a function module.
    but i am not understanding wat fields shd i put in it
    the function module is
    CALL FUNCTION <b>'MESSAGE_TEXT_BUILD'</b>
    EXPORTING
    msgid =
    msgnr =
    MSGV1 = ' '
    MSGV2 = ' '
    MSGV3 = ' '
    MSGV4 = ' '
    IMPORTING
    MESSAGE_TEXT_OUTPUT =
    can anyone tell wat shd i put on msgid ,msgnr and other fields.
    [email protected]

    Hello,
    Guid for unique identification assigned list
    It think it will generate the one unique key in the program.
    DATA: con_log_guid   TYPE  guid_16.
    CALL FUNCTION 'GUID_CREATE'
      IMPORTING
        ev_guid_16 = con_log_guid.
    WRITE con_log_guid .
    Try this example it is generating a 16number id.

  • Please help using substring()

    char[] data = new char[80];
                int len = 0;
                while ((len = br.read(data, 0, data.length)) != -1 ) {
                    //You do now have len characters available in the data.
                     line = new String(data, 0, data.length) + ",";
                     String firstName = line.substring(0,10) + ",";
                     String lasttName = line.substring(10,27) + ",";
                     String startDate = line.substring(27,35) + ",";
                     String address1 = line.substring(35,45) + ",";
                     String address2 = line.substring(45,55) + ",";
                     String city = line.substring(55,65) + ",";
                     String state = line.substring(65,67) + ",";
                     String country = line.substring(67,70) + ",";
                     String zip = line.substring(70,80);
                     String record = firstName+lasttName+startDate+address1+address2+city
                                              +state+country+zip;
                } I'm reading is a file with the code above, and then breaking the lines up into substrings manu with different sized fields. Using this sample input file:
    Bob Smith 12 North Rd Denver CO USA 12435
    Tom Jones 82 State St Miami FL USA 95764
    It reads in the first line fine (Bob, Smith, 12 North Rd, Denver, CO, USA, 12345), but the second line doesn't formatting like it should (ex: Jo,nes 82, State St Mi,ami ...etc)
    My guess is that maybe the last element may be causing the problem as in its reading the zip and reading out to 10 chars, but the zip is only 5, and I believe it mayb be overlapping and starting to read the next line somehow.
    Any help would be GREATLY appreciated.

    From the API documentation:
    Returns:
    The number of characters read, or -1 if the end of
    the stream has been reached. I'm assuming this is regarding the read(byte[]) method of BufferedInputStream?
    So how does it know it's reached the end of the
    stream(-1) if the actual end of the stream is beyond
    80 characters?If there is nothing to read when you call read() then it will return -1. If there is anything to be read, it will return the number of characters read.
    I'm asking because I don't know the answer, which I
    believe is the solution.No, this has nothing to do with the solution to your problem. The problem is that you're reading to much at a time, you should only read one line at a time.

  • Using a tweening function as a rollover.  Please help me restore functionality!

    Ok, I have a movieclip with 3 different tweens applied to it
    by a few functions. The first tween happens on rollover and makes
    the movieclip a little bigger, the second tween happens on rollout
    and makes it smaller. The third tween happens on release and makes
    the clip much bigger. However, when the user clicks the movie clip
    it deletes all of the rollover/rollout/onrelease commands so that
    the user can interact with a swf which is loaded into the mc.
    Here's my code so far:
    //Tweens//
    function grow(who) {
    who.onEnterFrame = function() {
    if (this._xscale<40) {
    this._xscale += 5;
    this._yscale += 5;
    if (this._xscale == 40 && this._yscale == 40) {
    delete this.onEnterFrame;
    function shrink(who) {
    who.onEnterFrame = function() {
    if (this._xscale>16.5) {
    this._xscale -= 5;
    this._yscale -= 5;
    if (this._xscale == 16.5 && this._yscale == 16.5) {
    delete this.onEnterFrame;
    function growBigger(who) {
    who.onEnterFrame = function() {
    if (this._xscale<100) {
    this._xscale += 5;
    this._yscale += 5;
    if (this._xscale == 100 && this._yscale == 100) {
    delete this.onEnterFrame;
    //End Tweens//
    loadMovie("preloader.swf", "preloader_mc");
    preloader_mc._xscale = 21;
    preloader_mc._yscale = 20;
    this.onRollOver = function() {
    grow(this);
    this.onRollOut = function() {
    shrink(this);
    this.onRelease = function() {
    delete onRollOver;
    delete onRollOut;
    delete onRelease;
    _root.MkXpos = _root.touristsMark._x;
    _root.MkYpos = _root.touristsMark._y;
    _root.pan(_root.mapContainer_mc);
    growBigger(this);
    _root.mapContainer_mc.map_mc.dragger_mc._visible = false;
    _root.drag = false;
    All of this works just fine. My only problem is that when the
    user exits the loaded swf I want the button to shrink back down and
    have its functionality restored. Basically when someone clicks the
    exit button on the external swf it runs the shrink(who) function
    and shrinks everything back down. I put a line of code into the
    shrink function when it checks to see if "who" is at 16.5, which
    looked like this:
    if (this._xscale == 16.5 && this._yscale == 16.5) {
    this.onRollOver = function = () {
    grow(this);
    delete this.onEnterFrame;
    However, that didn't restore the functionality. Any help
    would be greatly appreciated! I'm a poor student on a deadline

    I'm such a moron. I never put in a trace command to see if
    the last line of my shrink command was getting executed. It turns
    out the movie doesn't scale perfectly to 16.5 but instead goes to
    16.49etcetc. As a result that last line wasn't being executed. Now
    everything works. But I was wondering if you guys could think of a
    nice way to compartmentalize all of this code, like maybe store it
    all in a variable or something, so I can attach it to several
    different movie clips?

  • PLEASE help..class function not found..

    I am writing a simple email validation and I get a TON of errors.
    1) is Class function not found. on - function validateEmail();
    2) and 11 Undefined variable or class name: document .
    The code is listed below -
    <html>
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 1</title>
    <%
    function validateEmail();
    if (document.forms[0].EMAIL_ADDRESS.value.length != 0)
    if ( (document.forms[0].EMAIL_ADDRESS.value.indexOf("@") == -1) ||
    (document.forms[0].EMAIL_ADDRESS.value.charAt(0) == ".") ||
    (document.forms[0].EMAIL_ADDRESS.value.charAt(0) == "@") ||
    (document.forms[0].EMAIL_ADDRESS.value.length < 6) ||
    (document.forms[0].EMAIL_ADDRESS.value.indexOf(".") == -1) ||
    (document.forms[0].EMAIL_ADDRESS.charAt(document.forms[0].EMAIL_ADDRESS.value.indexOf("@")+1) == ".") ||
    (document.forms[0].EMAIL_ADDRESS.value.charAt(document.forms[0].EMAIL_ADDRESS.value.indexOf("@")-1) == ".") ||
    (document.forms[0].EMAIL_ADDRESS.value.charAt(0) == ' ') )
    alert ("Please enter valid email address");
    document.forms[0].EMAIL_ADDRESS.focus();
    document.forms[0].EMAIL_ADDRESS.select();
    return false;
    else
    return true;
    %>
    </head>
    -- lots of input fields with the last being -
    <input type="text" name=EMAIL_ADDRESS onBlur="validateEmail();"></td>
    ????

    When I remove tags <% %> all of the function ends up in html and thus on my page.
    <html>
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 1</title>
    <%
    function validateEmail();
    if (document.forms[0].EMAIL_ADDRESS.value.length != 0)
    if ( (document.forms[0].EMAIL_ADDRESS.value.indexOf("@") == -1) ||
    (document.forms[0].EMAIL_ADDRESS.value.charAt(0) == ".") ||
    (document.forms[0].EMAIL_ADDRESS.value.charAt(0) == "@") ||
    (document.forms[0].EMAIL_ADDRESS.value.length < 6) ||
    (document.forms[0].EMAIL_ADDRESS.value.indexOf(".") == -1) ||
    (document.forms[0].EMAIL_ADDRESS.charAt(document.forms[0].EMAIL_ADDRESS.value.indexOf("@")+1) == ".") ||
    (document.forms[0].EMAIL_ADDRESS.value.charAt(document.forms[0].EMAIL_ADDRESS.value.indexOf("@")-1) == ".") ||
    (document.forms[0].EMAIL_ADDRESS.value.charAt(0) == ' ') )
    alert ("Please enter valid email address");
    document.forms[0].EMAIL_ADDRESS.focus();
    document.forms[0].EMAIL_ADDRESS.select();
    return false;
    else
    return true;
    %>
    </head>
    <body bgcolor="powderblue">
    <Form Name="My Form" Action=userInfoInsert.jsp Method=Post>
    <table border="0" width="100%">
    <tr>
    <td width="100%">
    <table border="0" width="100%">
    <tr>
    <td width="41%">First Name     <input type="text" name=FIRST_NAME ></td>
    <td width="59%">Last Name
    <input type="text" name=LAST_NAME ></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td width="100%">Address         
    <input type="text" name=Address ></td>
    </tr>
    <tr>
    <td width="100%">Address         
    <input type="text" name=Address ></td>
    </tr>
    <tr>
    <td width="100%">
    <table border="0" width="100%">
    <tr>
    <td width="32%">City            
       <input type="text" name=CITY size=10></td>
    <td width="18%">State
    <input type="text" name=STATE size=5></td>
    <td width="50%">Zip Code
    <input type="text" name=ZIP_CODE size=10 ></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td width="100%">Phone #         
    <input type="text" name=PHONE size="15" ></td>
    </tr>
    <tr>
    <td width="100%">SSN              
    <input type="text" name=SSN size="17" ></td>
    </tr>
    <tr>
    <td width="100%">
    <table border="0" width="100%">
    <tr>
    <td width="41%">Hint Question <input type="text" name=FIRST_NAME ></td>
    <td width="59%">Hint Answer <input type="text" name=LAST_NAME ></td>
    </tr>
    </table>
    </tr>
    <tr>
    <td width="100%">User Name     <input type="text" name=USER_NAME ></td>
    </tr>
    <tr>
    <td width="100%">Password        <input type="text" name=PASSWORD ></td>
    </tr>
    <tr>
    <td width="100%">Re-Password  <input type="text" name=RE_PASSWORD ></td>
    </tr>
    <tr>
    <td width="100%">Email Address
    <input type="text" name=EMAIL_ADDRESS onBlur="validateEmail();"></td>
    </tr>
    </table>
    <INPUT type=Submit Value=Submit>
    </form>
    </body>
    </html>

  • Please help with search function

    Heya, im currently working on code that will allow me to add, view, search and remove prisoners and wardens from a prison system. So far i have managed to allow the user to add and view. Im a bit stuck on the search part of the code, its a bit temperamental :S, sometimes it will find and display the data, but other times it will not and comes up with the error
    Exception in thread "main" java.lang.NullPointerException
    at Prison.getNum(Prison.java:128)
    at TestPrison.main(TestPrison.java:101)
    Below i have put my Prison and TestPrison Class files and highlighted the lines the compiler said had the error, any help would be really appreciated because i really cant work out wats going on.
    Prison
    public class Prison
    private Prisoner [] thePrisoner;
    private Warden [] theWarden;
    private HighPrisoner [] theHighPrisoner;
    private int maxP;
    private int maxPrisoners;
    private int maxW;
    private int maxWardens;
    private int maxH;
    private int maxHighPrisoners;
    public String prisonName;
    public Prison (String prison, int maxP, int maxW, int maxH)
    prisonName = prison;
    maxPrisoners = maxP;
    maxP = 0;
    thePrisoner = new Prisoner [maxPrisoners];
    maxWardens = maxW;
    maxW = 0;
    theWarden = new Warden [maxWardens];
    maxHighPrisoners = maxH;
    maxH = 0;
    theHighPrisoner = new HighPrisoner [maxHighPrisoners];
    public boolean addPrisoner( Prisoner newPrisoner )
    if ( maxP == maxPrisoners )
    System.out.println("Prisons full");
    return false;
    else
    System.out.println("Prisoner now in Prison");
    thePrisoner[maxP] = newPrisoner;
    maxP++;
    return true;
    public boolean addHighPrisoner( HighPrisoner newHighPrisoner )
    if ( maxH == maxHighPrisoners )
    System.out.println("Prisons full");
    return false;
    else
    System.out.println("High Level Prisoner now in Prison");
    theHighPrisoner[maxH] = newHighPrisoner;
    maxH++;
    return true;
    public boolean addWarden( Warden newWarden )
    if ( maxW == maxWardens )
    System.out.println("We Have Anough Wardens");
    return false;
    else
    System.out.println("Warden now working at Prison");
    theWarden[maxW] = newWarden;
    maxW++;
    return true;
    public void outputAll()
    System.out.println("School Name: " + prisonName );
         System.out.println("");
    outputWardens();
         System.out.println("");
         outputPrisoners();
         System.out.println("");
    outputHighPrisoners();
    System.out.println("");
    public void outputWardens()
    System.out.println("The Wardens:");
    for( int i=0; i < maxW; ++i)
    System.out.println(theWarden);
    public void outputPrisoners()
    System.out.println("The Low Level Prisoners:");
    for( int i=0; i < maxP; ++i)
    System.out.println(thePrisoner[i]);
    public void outputHighPrisoners()
    System.out.println("The High Level Prisoners:");
    for( int i=0; i < maxH; ++i)
    System.out.println(theHighPrisoner[i]);
    public void getNum(String num)
    System.out.println("---------------");
    System.out.println("Search for Prisoner ID:");
    System.out.println("---------------");
    for(Prisoner nextPrisoner : thePrisoner)
         --> 128     if (nextPrisoner.getNum() == num)
              System.out.println(nextPrisoner);
    else
    System.out.println("Sorry no Prisoner ID found");
    for(HighPrisoner nextHighPrisoner : theHighPrisoner)
              if (nextHighPrisoner.getNum() == num)
              System.out.println(nextHighPrisoner);
    else
    System.out.println("Sorry No Prisoner ID found");
    System.out.println("");
    TestPrison
    import java.util.*;
    public class TestPrison
    public static void main(String []args)
         String sN;
    int sS;
         String sA;
         String tN;
    int tS;
         int input;
    String aN;
    int aS;
    String aA;
    int aL;
    String aC;
    String pN;
    String rN;
         Scanner kybd = new Scanner(System.in);
         Prison prison0 = new Prison("Alcatraz",200,200,100);
         do {
              menu();
              System.out.println("Enter Option: ");
              input = kybd.nextInt();
              switch(input) {
              case 1:
                   System.out.println("Enter Name: ");
                   tN = kybd.next();
                   System.out.println("Enter Rank: ");
                   tS = kybd.nextInt();
                   Warden wardenObject = new Warden(tN,tS);
                   prison0.addWarden(wardenObject);
                   System.out.println("\nWarden "+tN+" Added!");
                   break;
    case 2:
    System.out.println("Enter Prisoner Security Level: ");
    aL = kybd.nextInt();
    if (aL > 3)
    System.out.println("Enter Name: ");
                   aN = kybd.next();
                   System.out.println("Enter Remaining Jail Time: ");
                   aS = kybd.nextInt();
                   System.out.println("Enter Prisoner ID: ");
                   aA = kybd.next();
    System.out.println("Can Prisoner Share Cell? ");
    aC = kybd.next();
                   HighPrisoner highprisonerObject = new HighPrisoner(aN,aS,aA,aL,aC);
                   prison0.addHighPrisoner(highprisonerObject);
                   System.out.println("\nPrisoner " + aA + " Added!");
                   break;
    else
    System.out.println("Enter Name: ");
                   sN = kybd.next();
                   System.out.println("Enter Remaining Jail Time: ");
                   sS = kybd.nextInt();
                   System.out.println("Enter Prisoner ID: ");
                   sA = kybd.next();
                   Prisoner prisonerObject = new Prisoner(sN,sS,sA);
                   prison0.addPrisoner(prisonerObject);
                   System.out.println("\nPrisoner " + sA + " Added!");
                   break;
              case 3:
                   prison0.outputAll();
                   break;
              case 4:
                   prison0.outputWardens();
                   break;
              case 5:
                   prison0.outputPrisoners();
         break;
    case 6:
    prison0.outputHighPrisoners();
    break;
    case 7:
    prison0.outputPrisoners();
    prison0.outputHighPrisoners();
    break;
    case 8:
    System.out.println("Enter Prisoner ID: ");
                   pN = kybd.next();
    ---> 101 prison0.getNum(pN);
    break;
              default:
                   System.out.println("Error Selection Does Not Exist");
                   break;
         } while(input >= 0);
    public static void menu() {
         System.out.println("");
         System.out.println("MAIN MENU");
         System.out.println("*********\n");
         System.out.println("1. Add Warden\n");
    System.out.println("2. Add Prisoner\n");
         System.out.println("3. View All\n");
         System.out.println("4. View Wardens\n");
         System.out.println("5. View Low Level Prisoners\n");
    System.out.println("6. View High Level Prisoners\n");
    System.out.println("7. View All Prisoners\n");
    System.out.println("8. Search Prisoner ID\n\n");
    Once again any help would really be appreciated : )

    The nextPrisoner is null, and you can't call getNum() on a null reference.
    Try replacing that line with:if (nextPrisoner != null && nextPrisoner.getNum() == num) Oh, next time you're posting code, please use code tags:
    http://forum.java.sun.com/help.jspa?sec=formatting

Maybe you are looking for

  • CS6 Render Lighting

    Render Lighting (and other 3D things) don't work on my laptop. Initially in Preferences Performance, Use Graphics Processor wasn't checked. In that scenario, I didn't get the first message below - just the secind one (not enough memory). I go back to

  • How to efficiently select a block of text in iOS

    I'm a relatively new iPad user who has brought his iPad into hospital. I'm frequently find iOS to be quirky. There are frequent times when I cannot select the specific phrase i want to capture. iOS guesses and almost always guesses way wrong, way, wa

  • Gave my old iPad to my wife - how do I switch the Apple ID associated with that iPad from mine to my wife's?

    I bought a new iPad and gave my old iPad to my wife. Every time she goes to buy an app or song it pops up with my Apple ID. We changed it to her Apple ID in the settings/iTunes & App Store. That made it so her ID came up when making purchases, but he

  • Mail does not receive messages

    I transferred all my data to a new iMac with Lion from my old iMac with Snow Leopard, and the Mail settings did arrive correctly. But I cannot receive any mail from either of my accounts. I tried connection doctor, and even though the receiving butto

  • Why should I remain a Verizon customer?

         I do not understand, I once had 4 lines, I am now down to having 1.  The reason PRICE!!!!  Verizon is aware they are expensive, that is why they offer certain loyalty plans.  I called to switch plans was offered a loyalty plan, my bill went from