Please help in my first jdbc code

hi,
in this code i want to get author book name from my database
but the problem that : the compiler give error on these lines :
statement= connection.createStatement();
ResultSet resultset = statement.executeQuery("");
statement.close();
please see my code and help me
import java.awt.Container;
import java.beans.Statement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
public class DisplayAuthors extends JFrame {
    static final String JDBC_DRIVER = "";
    static final String DATABASE_URL="JDBC:db2j:library";
    private Connection connection;
    private Statement statement;
    public DisplayAuthors(){
        try{
            System.setProperty("db2j.system.home", "C:/Documents and Settings/beshoy/My Documents/NetBeansProjects/JDBC");
            Class.forName(JDBC_DRIVER);
            connection=DriverManager.getConnection(DATABASE_URL);
            statement=  (Statement) connection.createStatement();
            ResultSet resultset/*=statement.executeQuery("")*/;
            StringBuffer results= new StringBuffer();
            ResultSetMetaData metadata=resultset.getMetaData();
            int numberofcol=metadata.getColumnCount();
            for(int i=0;i<numberofcol;++i){
                results.append(metadata.getCatalogName(i)+"\t");
            results.append("\n");
            while(resultset.next()){
                for(int i=1;i<=numberofcol;++i){
                    results.append(resultset.getObject(i)+"\t");
                results.append("\n");
            JTextArea area=new JTextArea(results.toString());
            Container container=getContentPane();
            container.add(new JScrollPane(area));
            setSize(300,100);
            setVisible(true);
        catch(ClassNotFoundException classnotfound){
            JOptionPane.showMessageDialog(null,classnotfound.getMessage(),"Database error",JOptionPane.ERROR_MESSAGE);
            System.exit(1);
        catch(ClassNotFoundException classnotfound){
            JOptionPane.showMessageDialog(null,classnotfound.getMessage(),"Driver not found", JOptionPane.ERROR_MESSAGE);
            System.exit(1);
        finally{
            try{
                statement.close();
                connection.close();
            catch(SQLException sqlexception){
                JOptionPane.showMessageDialog(null, sqlexception.getMessage(),"Database error",JOptionPane.ERROR_MESSAGE);
                System.exit(1);
    public static void main(String[]args){
        DisplayAuthors window=new DisplayAuthors();
        window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}thanks in advance

beshoy wrote:
Compiling 1 source file to C:\Documents and Settings\beshoy\My Documents\NetBeansProjects\JDBC\build\classes
C:\Documents and Settings\beshoy\My Documents\NetBeansProjects\JDBC\src\project\DisplayAuthors.java:30: incompatible types
found : java.sql.Statement
required: java.beans.Statement
statement= connection.createStatement();You declared 'statement' as java.beans.Statement instead of java.sql.Statement. The Connection#createStatement() returns java.sql.Statement, not java.beans.Statement.
How did you miss this one in the JDBC tutorial? [http://java.sun.com/docs/books/tutorial/jdbc/index.html]
C:\Documents and Settings\beshoy\My Documents\NetBeansProjects\JDBC\src\project\DisplayAuthors.java:31: cannot find symbol
symbol : method executeQuery(java.lang.String)
location: class java.beans.Statement
ResultSet resultset = statement.executeQuery("");This one will solve itself if you fix the first error.
C:\Documents and Settings\beshoy\My Documents\NetBeansProjects\JDBC\src\project\DisplayAuthors.java:68: cannot find symbol
symbol : method close()
location: class java.beans.Statement
statement.close();This one will solve itself if you fix the first error.

Similar Messages

  • Please help me transform this C++ code to java code....

    guys...please help me transform this C++ code to java code....please try to explain the code..thanks
    [program]
    #include <stdio.h>
    #define ALIVE 1
    #define DEAD 0
    #define SZ 33
    int stschk (int ,int );
    main()
    int s[SZ][SZ], i, j;
    for (i=0; i<sz; i++ ) s[0] = DEAD;
    for (j=0; j<sz; j++ ) s[0][j] = DEAD;
    s[0][1] = ALIVE;
    for (i=0; i<sz-1; i++) {
    for ( j=1;j<sz;j++ ) {
    s[i][j] = stschk(s[i][j-1],s[i+1][j];
    if(s[i][j-1]==ALIVE) printf("*");
    else printf(" ");
    printf("\n");
    int stschk(int s1,int s2)
    if(((s1==DEAD)&&(s2==ALIVE))||
    ((s1==ALIVE)&&(s2==DEAD))) return ALIVE;
    else return DEAD;

    Being picky, that's not C++, that's C. Standard headers in C++ dont' have .h after them, loop variables are scoped with the for, you use constants rather than #defines, etc..
    C and C++ both don't initialise arrays by default; you'd have to write an initialiser to get it to zero out the array:
        int s[sz][sz] = {};gcc will insert a call to memset to zero the array.
    If the author was assuming that the array was zeroed out, there would be no point zeroing the first row and column.
    The code reads values which haven't been initialised. If you mark such values explicitly undefined, and change the program to report an error when undefined, then you get several cases where the program makes such report.
    So either it' s a primitive random number generator (some random number generators use uninitialised memory as a source of randomness), or it's buggy, or it's processing undefined data and throwing away the result. Either way, it cannot be directly be ported to Java if the undefined values (which are limited to a small area of the ouput) are significant.

  • I forgot restrictions cod in ipad air1 and don't off it , please help me for recovery this cod

    i forgot restrictions cod in ipad air1 and don't off it , please help me for recovery this cod...

    Locked Out, Forgot Lock or Restrictions Passcode, or Need to Restore Your Device: Several Alternative Solutions
    A
    1. iOS- Forgotten passcode or device disabled after entering wrong passcode
    2. iPhone, iPad, iPod touch: Wrong passcode results in red disabled screen
    3. Restoring iPod touch after forgotten passcode
    4. What to Do If You've Forgotten Your iPhone's Passcode
    5. iOS- Understanding passcodes
    6. iTunes 10 for Mac- Update and restore software on iPod, iPhone, or iPad
    7. iOS - Unable to update or restore
    Forgotten Restrictions Passcode Help
                iPad,iPod,iPod Touch Recovery Mode
    You will need to restore your device as New to remove a Restrictions passcode. Go through the normal process to restore your device, but when you see the options to restore as New or from a backup, be sure to choose New.
    You can restore from a backup if you have one from BEFORE you set the restrictions passcode.
    Also, see iTunes- Restoring iOS software.
    And also see How to Recover Forgotten iPhone, iPad Restrictions Passcode.

  • Please help me to complete this code

    import java.security.MessageDigest;
    import java.util.Map;
    import java.util.Scanner;
    public class PasswordService
       //The hash is to be formed using the SHA algorithm
       //to create a MessageDigest
       private final String algorithmName = "SHA";
       //Use a message digest to create hashed passwords
       private MessageDigest md = null;
       //We simulate a database of users using who have a login and password
       //as a key and value pair in a Map
       private Map<String, byte[]> userData;
       //complete the constructor
       public PasswordService()
         //TODO - intialize the class instance data
          //some dummy data - do not alter these lines
          addUser("daddy", "cool");
          addUser("nightflight", "topChat");
          addUser("boney", "2E5sxuSRg6A");
       public void showProvider()
          //TODO
       //Get the hash value for the provided string password.
         public byte[] getHash(String password)
          //TODO
          return null;
       public void addUser(String login, String password)
          //TODO
       public byte[] getPassword(String login)
          //TODO
          return null;
       public boolean checkLogin(String login, String password)
         // TODO
          return false;
       //This method is provided to perform a login from the command line
       public boolean doLogin()
          Scanner sc = new Scanner(System.in);
          System.out.println("Enter login please");
          String login = sc.next();
          System.out.println("Your password please");
          String password = sc.next();
          return checkLogin(login, password);
       public static void main(String[] args)
          int attempts = 0;
          showProvider();
          while(attempts < 4)
             boolean match = doLogin(); //request login and password
             System.out.println("match? " + match);
             attempts++;
    }

    please help me to complete this code
    void completeCode(Code code,Properties options) throws CodeCompletingException
    CodeCompleterFactory cf = CodeCompleterFactory.newInstance();
    CodeCompleter cc = cf.newCodeCompleter();
    cc.complete(code,options);
    }

  • I ordered mac OS and I got the email for License and I didnt get the attachement for content code. Please help me getting the content code.

    I ordered mac OS and I got the email for License and I didnt get the attachement for content code. Please help me getting the content code.

    It's a two email process, one email has a locked pdf with the redemption code. The second email has the password to unlock the pdf. They come separetly, so you may have to wait for the 2nd to arrive.

  • Java beginner, please help!! (oracle jdbc setting)

    Hi, I am a java beginner. I can't access remote oracle db from my computer. please help me. I can't figure out the problem.
    1.The error------------------------------------------------------------
    Exception in thread "main" java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getConnection(DriverManager.java:532)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at testdb.main(testdb.java:9)
    2.JDBC DRIVER is in----------------------------------------------------
    c:\j2sdk1.4.1_02\jdbc\classes12.zip
    3.CLASSPATH is --------------------------------------------------------
    .;c:\j2sdk1.4.1_02\bin;c:\j2sdk1.4.1_02\jdbc;
    4.My program is--------------------------------------------------------
    import java.sql.*;
    class testdb
    public static void main (String args[])
    throws SQLException,ClassNotFoundException
    Connection conn=
    DriverManager.getConnection("jdbc:oracle:thin:@111.31.111.11:1526:ORA81","scott","tiger");
    Statement stmt = conn.createStatement();
    ResultSet rset=stmt.executeQuery("SELECT EMPNO FROM EMP");
    while (rset.next()) {
    System.out.println (rset.getString(1));
    5. Why can't i connect to db?

    Hi...i have the same problem and can't seem to solve it
    this is my source code
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    public class TextToDatabaseTable {
    public static void main (String[] args) {
    try {
    // connect to db
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection con = DriverManager.getConnection("jdbc:oracle:thin:@cs-bid:1521:SVRDESK", "lynn", "abc");
    catch( Exception e) {
    e.printStackTrace();
    and this is my error
    java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at TextToDatabaseTable.main(TextToDatabaseTable.java:12)
    and i try the methods above
    C:\download\Lynn>java -classpath c:\download\lynn;classes12.zip TextToDatabaseTable
    C:\download\Lynn>java TextToDatabaseTable
    java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at TextToDatabaseTable.main(TextToDatabaseTable.java:12)
    i'm using oracle 8i with tomcat on win 2k server.
    i dunno what's wrong with it...do i need to set any classpath?
    i have TOMCAT_HOME and JAVA_HOME Variables in My Environment Variables.
    Do i need to set anything for these variables?
    Do i need to download any patches? I'm kinda confused.
    Thanks!

  • PLEASE HELP! Photoshop CS3 Error code

    My photoshop out of the blue just stopped working. It goes go to the loading part, then it finishes loading. Stays there for like 5 seconds then it crashes.
    Adobe Fireworks works perfect, however photoshop doesn't anymore.
    Please help, this is urgent as I use photoshop daily.
    I deleted the preferences. Held shift, del and ctrl and deleted the settings. but still nothing. I renamed the "twain32" and still nothing.
    This is the error information
    Problem signature:
      Problem Event Name:    APPCRASH
      Application Name:    Photoshop.exe
      Application Version:    10.0.0.0
      Application Timestamp:    4601eae8
      Fault Module Name:    StackHash_1703
      Fault Module Version:    0.0.0.0
      Fault Module Timestamp:    00000000
      Exception Code:    c0000005
      Exception Offset:    00000000
      OS Version:    6.0.6000.2.0.0.256.1
      Locale ID:    1033
      Additional Information 1:    1703
      Additional Information 2:    2264db07e74365624c50317d7b856ae9
      Additional Information 3:    1344
      Additional Information 4:    875fa2ef9d2bdca96466e8af55d1ae6e
    PLEASE HELP!

    A quick google returned:
    The problem is that there's no such module as "StackHash_1703", so this  appears to be some special case in Windows. I tried turning off  antivirus and enabling compatibility mode, but the application still  would not work.
    The problem was that I had DEP (Data Execution Protection) enabled. For  whatever reason, the error message gave me the AppCrash error above  instead of the standard message about "DEP has closed the program."
    To solve the problem, I added the application to the DEP exclusion list and everything worked again.

  • Please help me find out my code..I am using msg ACCept and Reject

    Please anyone help me...
    I am using MSG ACCEPT and REJECT...
    but my code when I execute it...it keep show out MSG REJECT...
    Please help me...Thanks a lot....
    public class Addmission
    public static void main(String[] args) throws Exception
    char Message;
    double GPA = 3.0;
    int ATS = 60;
    int ATScore = 80;
    System.out.println("Enter your Grade Point Average");
    GPA = (char)System.in.read();
    System.out.println("Enter your Addmission Test Score");
    ATS =(char)System.in.read();
    System.in.read(); System.in.read();
         if(GPA >= 3.0 && ATS == 60)
    System.out.println("Accept");
    if(GPA <= 3.0 && ATScore == 80)
    System.out.println("Accept");
    else
    System.out.println("Reject");

    I need to do like... but my code doens't show msg "Accept" it keep going to show "REJECT"
    Could anyone help me out?
    Print the msg "Accept" if the student has any of the following:
    * A grade point average of 3.0 or above and admission test score of at least 60
    * A grade point average of below 3.0 and an admission test score of at least 80.If the student doesn't meet either of the qualification criteria, print "Reject"
    public class Addmission
    public static void main(String[] args) throws Exception
    char Message;
    double GPA = 3.0;
    int ATS = 60;
    int ATScore = 80;
    System.out.println("Enter your Grade Point Average");
    GPA = (char)System.in.read();
    System.out.println("Enter your Addmission Test Score");
    ATS =(char)System.in.read();
    System.in.read(); System.in.read();
    if(GPA >= 3.0 && ATS == 60)
    System.out.println("Accept");
    if(GPA <= 3.0 && ATScore == 80)
    System.out.println("Accept");
    else
    System.out.println("Reject");

  • Please help me out with my code I am writing MSG ACCEPT & REJECT

    Please anyone help me...
    I am using MSG ACCEPT and REJECT...
    but my code when I execute it...it keep show out MSG REJECT...
    Please help me...Thanks a lot....
    public class Addmission
    public static void main(String[] args) throws Exception
    char Message;
    double GPA = 3.0;
    int ATS = 60;
    int ATScore = 80;
    System.out.println("Enter your Grade Point Average");
    GPA = (char)System.in.read();
    System.out.println("Enter your Addmission Test Score");
    ATS =(char)System.in.read();
    System.in.read(); System.in.read();
         if(GPA >= 3.0 && ATS == 60)
    System.out.println("Accept");
    if(GPA <= 3.0 && ATScore == 80)
    System.out.println("Accept");
    else
    System.out.println("Reject");

    see the implementaiton of readAFloat() ...
    implementation of readAnInt() is left as an exercise to you.
    cheers
    public class Addmission
    public static void main(String[] args) throws Exception
    char Message;
    double GPA = 3.0;
    int ATS = 60;
    int ATScore = 80;
    System.out.println("Enter your Grade Point Average");
    GPA = readAFloat();
    System.out.println("Enter your Addmission Test Score");
    ATS = readAnInt();
    System.out.println(" Your GPA ["+GPA+"]");
    System.out.println(" Your ATS ["+ATS+"]");
    if(GPA >= 3.0 && ATS == 60)
    System.out.println("Accept");
    if(GPA <= 3.0 && ATScore == 80)
    System.out.println("Accept");
    else
    System.out.println("Reject");
    public static float readAFloat() throws Exception {
         byte ba[]=new byte[10];
         int len;
         len=System.in.read(ba, 0, ba.length);
         String s = new String(ba, 0, len);
         float f=Float.parseFloat(s);
         return(f);
    public static int readAnInt() throws Exception {
         return 80;

  • Please help me to identify unnecessary code in these two procedures

    Hi,
    Please help me to tune these two procedures.
    I think some unnecessary code is existed in these two procedures.
    Please help me to identify those lines.
      PROCEDURE InsertIntoScoreTables(pBUID       IN ORDER_SCORE_REASON.BUID%TYPE,
                                      OrderNum    IN ORDER_SCORE_REASON.ORDER_NUM%TYPE,
                                      ReasonCode  IN MASTER_REASON.REASON_CODE%TYPE,
                                      MatchResult IN ORDER_SCORE_REASON.MATCH_RESULT%TYPE,
                                      ScoreType   IN MASTER_REASON.REASON_TYPE%TYPE,
                                      AddressType IN MASTER_REASON.ADDRESS_TYPE%TYPE) IS
        tCount       NUMBER := 0;
        tScoreID     MASTER_REASON.REASON_ID%TYPE := 0;
        tReasonSeq   MASTER_REASON.REASON_SEQ%TYPE := 0;
        tAddressType MASTER_REASON.ADDRESS_TYPE%TYPE := AddressType;
        tExists NUMBER :=0;
      BEGIN
        if AddressType is NULL then
           tAddressType:='';
        end if;
        IF LENGTH(tAddressType) > 0 THEN
          SELECT COUNT(mstr.reason_code)
            INTO tCount
            FROM MASTER_REASON mstr
           WHERE mstr.REASON_CODE = ReasonCode AND mstr.ENABLED_FLAG = 'Y' AND
                 mstr.ADDRESS_TYPE = tAddressType AND
                 mstr.REASON_TYPE = ScoreType;
        ELSE
          SELECT COUNT(mstr.reason_code)
            INTO tCount
            FROM MASTER_REASON mstr
           WHERE mstr.REASON_CODE = ReasonCode AND mstr.ENABLED_FLAG = 'Y' AND
                 mstr.REASON_TYPE = ScoreType;
        END IF;
        IF tCount > 0 THEN
          IF LENGTH(tAddressType) > 0 THEN
            SELECT mstr.REASON_ID, mstr.REASON_SEQ
              INTO tScoreID, tReasonSeq
              FROM MASTER_REASON mstr
             WHERE mstr.REASON_CODE = ReasonCode AND mstr.ENABLED_FLAG = 'Y' AND
                   mstr.ADDRESS_TYPE = tAddressType AND
                   mstr.REASON_TYPE = ScoreType AND ROWNUM = 1;
          ELSE
            SELECT mstr.REASON_ID, mstr.REASON_SEQ
              INTO tScoreID, tReasonSeq
              FROM MASTER_REASON mstr
             WHERE mstr.REASON_CODE = ReasonCode AND mstr.ENABLED_FLAG = 'Y' AND
                   mstr.REASON_TYPE = ScoreType AND ROWNUM = 1;
          END IF;
          /*INSERT INTO SCORE_REASON_CODES (ORDER_NUM, BUID, ADDRESS_TYPE, REASON_CODE, REASON_SEQ, VENDOR_CODE, MATCH_RESULT)
          VALUES (OrderNum, BUID, tAddressType, ReasonCode, tReasonSeq, VendorCode, MatchResult);*/
          SELECT COUNT(*) INTO tExists FROM ORDER_SCORE_REASON WHERE ORDER_NUM = OrderNum AND BUID = pBUID AND REASON_ID = tScoreID;
          IF tExists > 0 THEN
             DELETE FROM ORDER_SCORE_REASON WHERE ORDER_NUM = OrderNum AND BUID = pBUID AND REASON_ID = tScoreID;
          END IF;
          INSERT INTO ORDER_SCORE_REASON
            (ORDER_NUM,
             BUID,
             REASON_ID,
             REASON_SEQ,
             MATCH_RESULT,
             CREATED_BY,
             CREATED_DATE)
          VALUES
            (OrderNum,
             pBUID,
             tScoreID,
             tReasonSeq,
             MatchResult,
             'ISR',
             SYSDATE);
          --todo: comment below line when done
          --COMMIT;
        END IF;
      END InsertIntoScoreTables;
      PROCEDURE InsertNegScoringtoTable(pBUID         IN ORDER_SCORE_REASON.BUID%TYPE,
                                        OrderNum      IN ORDER_SCORE_REASON.ORDER_NUM%TYPE,
                                        ReasonCode    IN MASTER_REASON.REASON_CODE%TYPE,
                                        MatchResult   IN ORDER_SCORE_REASON.MATCH_RESULT%TYPE,
                                        ScoreType     IN MASTER_REASON.REASON_TYPE%TYPE,
                                        AddressType   IN MASTER_REASON.ADDRESS_TYPE%TYPE,
                                        MatchingBUIDs IN Varchar2) IS
        tCount            NUMBER := 0;
        tScoreReasonCount NUMBER := 0;
        tScoreID          MASTER_REASON.REASON_ID%TYPE := 0;
        tReasonSeq        MASTER_REASON.REASON_SEQ%TYPE := 0;
        tAddressType      MASTER_REASON.ADDRESS_TYPE%TYPE := AddressType;
      BEGIN
        if AddressType is NULL then
           tAddressType:='';
        end if;
        IF LENGTH(tAddressType) > 0 THEN
          SELECT COUNT(mstr.reason_code)
            INTO tCount
            FROM MASTER_REASON mstr
           WHERE mstr.REASON_CODE = ReasonCode AND mstr.ENABLED_FLAG = 'Y' AND
                 trim(mstr.ADDRESS_TYPE) = tAddressType AND
                 mstr.REASON_TYPE = ScoreType;
        ELSE
          SELECT COUNT(mstr.reason_code)
            INTO tCount
            FROM MASTER_REASON mstr
           WHERE mstr.REASON_CODE = ReasonCode AND mstr.ENABLED_FLAG = 'Y' AND
                 mstr.REASON_TYPE = ScoreType;
        END IF;
        IF tCount > 0 THEN
          IF LENGTH(tAddressType) > 0 THEN
            SELECT mstr.REASON_ID, mstr.REASON_SEQ
              INTO tScoreID, tReasonSeq
              FROM MASTER_REASON mstr
             WHERE mstr.REASON_CODE = ReasonCode AND mstr.ENABLED_FLAG = 'Y' AND
                   mstr.ADDRESS_TYPE = tAddressType AND
                   mstr.REASON_TYPE = ScoreType AND ROWNUM = 1;
          ELSE
            SELECT mstr.REASON_ID, mstr.REASON_SEQ
              INTO tScoreID, tReasonSeq
              FROM MASTER_REASON mstr
             WHERE mstr.REASON_CODE = ReasonCode AND mstr.ENABLED_FLAG = 'Y' AND
                   mstr.REASON_TYPE = ScoreType AND ROWNUM = 1;
          END IF;
          /*INSERT INTO SCORE_REASON_CODES (ORDER_NUM, BUID, ADDRESS_TYPE, REASON_CODE, REASON_SEQ, VENDOR_CODE, MATCH_RESULT)
          VALUES (OrderNum, BUID, tAddressType, ReasonCode, tReasonSeq, VendorCode, MatchResult);*/
          If tScoreID is not Null Then
            SELECT COUNT(REASON_ID)
              INTO tScoreReasonCount
              FROM ORDER_SCORE_REASON
             WHERE BUID = pBUID AND ORDER_NUM = OrderNum AND
                   REASON_ID = tScoreID;
            If tScoreReasonCount = 0 Then
              INSERT INTO ORDER_SCORE_REASON
                (ORDER_NUM,
                 BUID,
                 REASON_ID,
                 REASON_SEQ,
                 MATCH_RESULT,
                 CREATED_BY,
                 CREATED_DATE,
                 MATCH_BUIDS)
              VALUES
                (OrderNum,
                 pBUID,
                 tScoreID,
                 tReasonSeq,
                 MatchResult,
                 'ISR',
                 SYSDATE,
                 MatchingBUIDs);
            End If;
          End If;
          --todo: comment below line when done
          --COMMIT;
        END IF;
      END InsertNegScoringtoTable;Thanks in advance.

    PROCEDURE insertintoscoretables (
       pbuid         IN   order_score_reason.buid%TYPE,
       ordernum      IN   order_score_reason.order_num%TYPE,
       reasoncode    IN   master_reason.reason_code%TYPE,
       matchresult   IN   order_score_reason.match_result%TYPE,
       scoretype     IN   master_reason.reason_type%TYPE,
       addresstype   IN   master_reason.address_type%TYPE
    IS
       tcount         NUMBER                            := 0;
       tscoreid       master_reason.reason_id%TYPE      := 0;
       treasonseq     master_reason.reason_seq%TYPE     := 0;
       taddresstype   master_reason.address_type%TYPE   := addresstype;
       texists        NUMBER                            := 0;
    BEGIN
       IF addresstype IS NULL
       THEN
          taddresstype := NULL;
       END IF;
    --   IF LENGTH (taddresstype) > 0
    --   THEN
       BEGIN
          SELECT COUNT (mstr.reason_code)
            INTO tcount
            FROM master_reason mstr
           WHERE mstr.reason_code = reasoncode
             AND   mstr.enabled_flag = 'Y'
                  AND (  LENGTH (taddresstype) > 0
                  AND mstr.address_type = taddresstype
             AND mstr.reason_type = scoretype;
       EXCEPTION
          WHEN NO_DATA_FOUND
          THEN
             tscoreid := NULL;
             treasonseq := NULL;
          WHEN OTHERS
          THEN
             raise_application_error (-20223, 'others');
       END;
    --   ELSE
    --      SELECT COUNT (mstr.reason_code)
    --        INTO tcount
    --        FROM master_reason mstr
    --       WHERE mstr.reason_code = reasoncode
    --         AND mstr.enabled_flag = 'Y'
    --         AND mstr.reason_type = scoretype;
    --   END IF;
       IF tcount > 0
       THEN
          BEGIN
             SELECT mstr.reason_id, mstr.reason_seq
               INTO tscoreid, treasonseq
               FROM master_reason mstr
              WHERE mstr.reason_code = reasoncode
                AND mstr.enabled_flag = 'Y'
                AND (LENGTH (taddresstype) > 0
                     AND mstr.address_type = taddresstype
                AND mstr.reason_type = scoretype
                AND ROWNUM = 1;
          EXCEPTION
             WHEN NO_DATA_FOUND
             THEN
                tscoreid := NULL;
                treasonseq := NULL;
             WHEN OTHERS
             THEN
                raise_application_error (-20223, 'others');
          END;
          /*INSERT INTO SCORE_REASON_CODES (ORDER_NUM, BUID, ADDRESS_TYPE, REASON_CODE, REASON_SEQ, VENDOR_CODE, MATCH_RESULT)
          VALUES (OrderNum, BUID, tAddressType, ReasonCode, tReasonSeq, VendorCode, MatchResult);*/
          BEGIN
             SELECT 'Y'
               INTO texists
               FROM order_score_reason
              WHERE order_num = ordernum AND buid = pbuid AND reason_id = tscoreid;
             IF SQL%ROWCOUNT = 0
             THEN
                BEGIN
                   INSERT INTO order_score_reason
                               (order_num, buid, reason_id, reason_seq,
                                match_result, created_by, created_date
                        VALUES (ordernum, pbuid, tscoreid, treasonseq,
                                matchresult, 'ISR', SYSDATE
                EXCEPTION
                   WHEN OTHERS
                   THEN
                      raise_application_error (-20223, 'others');
                END;
             ELSE
                BEGIN
                   DELETE FROM order_score_reason
                         WHERE order_num = ordernum
                           AND buid = pbuid
                           AND reason_id = tscoreid;
                EXCEPTION
                   WHEN OTHERS
                   THEN
                      raise_application_error (-20223, 'others');
                END;
             END IF;
          END;
    --      IF texists > 0
    --      THEN
    --         DELETE FROM order_score_reason
    --               WHERE order_num = ordernum
    --                 AND buid = pbuid
    --                 AND reason_id = tscoreid;
    --      END IF;
       -- INSERT INTO order_score_reason
    --                  (order_num, buid, reason_id, reason_seq, match_result,
    --                   created_by, created_date
    --           VALUES (ordernum, pbuid, tscoreid, treasonseq, matchresult,
    --                   'ISR', SYSDATE
       --todo: comment below line when done
       --COMMIT;
       END IF;
    END insertintoscoretables;
    PROCEDURE insertnegscoringtotable (
       pbuid           IN   order_score_reason.buid%TYPE,
       ordernum        IN   order_score_reason.order_num%TYPE,
       reasoncode      IN   master_reason.reason_code%TYPE,
       matchresult     IN   order_score_reason.match_result%TYPE,
       scoretype       IN   master_reason.reason_type%TYPE,
       addresstype     IN   master_reason.address_type%TYPE,
       matchingbuids   IN   VARCHAR2
    IS
       tcount              NUMBER                            := 0;
       tscorereasoncount   NUMBER                            := 0;
       tscoreid            master_reason.reason_id%TYPE      := 0;
       treasonseq          master_reason.reason_seq%TYPE     := 0;
       taddresstype        master_reason.address_type%TYPE   := addresstype;
    BEGIN
       IF addresstype IS NULL
       THEN
          taddresstype := '';
       END IF;
       BEGIN
          SELECT COUNT (mstr.reason_code)
            INTO tcount
            FROM master_reason mstr
           WHERE mstr.reason_code = reasoncode
             AND mstr.enabled_flag = 'Y'
                  AND  (   LENGTH (taddresstype) > 0
                  AND mstr.address_type = taddresstype
             AND mstr.reason_type = scoretype;
       EXCEPTION
          WHEN NO_DATA_FOUND
          THEN
             tscoreid := NULL;
             treasonseq := NULL;
          WHEN OTHERS
          THEN
             raise_application_error (-20223, 'others');
       END;
       IF tcount > 0
       THEN
          BEGIN
             SELECT mstr.reason_id, mstr.reason_seq
               INTO tscoreid, treasonseq
               FROM master_reason mstr
              WHERE mstr.reason_code = reasoncode
                AND mstr.enabled_flag = 'Y'
                AND (LENGTH (taddresstype) > 0
                     AND mstr.address_type = taddresstype
                AND mstr.reason_type = scoretype
                AND ROWNUM = 1;
          EXCEPTION
             WHEN NO_DATA_FOUND
             THEN
                tscoreid := NULL;
                treasonseq := NULL;
             WHEN OTHERS
             THEN
                raise_application_error (-20223, 'others');
          END;
          /*INSERT INTO SCORE_REASON_CODES (ORDER_NUM, BUID, ADDRESS_TYPE, REASON_CODE, REASON_SEQ, VENDOR_CODE, MATCH_RESULT)
          VALUES (OrderNum, BUID, tAddressType, ReasonCode, tReasonSeq, VendorCode, MatchResult);*/
          IF tscoreid IS NOT NULL
          THEN
             SELECT 'Y'
               INTO tscorereasoncount
               FROM order_score_reason
              WHERE buid = pbuid AND order_num = ordernum AND reason_id = tscoreid;
             IF SQL%ROWCOUNT = 0                           --tscorereasoncount = 0
             THEN
                BEGIN
                   INSERT INTO order_score_reason
                               (order_num, buid, reason_id, reason_seq,
                                match_result, created_by, created_date,
                                match_buids
                        VALUES (ordernum, pbuid, tscoreid, treasonseq,
                                matchresult, 'ISR', SYSDATE,
                                matchingbuids
                EXCEPTION
                   WHEN OTHERS
                   THEN
                      raise_application_error (-20223, 'others');
                END;
             END IF;
          END IF;
       --todo: comment below line when done
       --COMMIT;
       END IF;
    END insertnegscoringtotable;regards,
    friend
    Edited by: most wanted!!!! on Apr 22, 2013 3:49 AM

  • Please help me on inter-company code configuration steps

    Hi FICO Gurus,
    Please can you help me on inter-company code configuration steps and accounting entries for the same.
    Thanks for your help!!...
    Thanks & Regards,
    Kiran

    guys I still need help on this one...Thanks!

  • PLEASE HELP ME TO MODIFY THE CODE !

    DATA:BEGIN OF I_PARTNER OCCURS 0,
           VBELN LIKE VBPA-VBELN,
           adrnr like vbpa-adrnr,
           kunnr LIKE vbpa-kunnr,
           PARVW LIKE VBPA-PARVW,
           post_code1 LIKE adrc-post_code1,
           po_box LIKE adrc-po_box,
           name1 LIKE adrc-name1,
           name2 LIKE adrc-name2,
           city1 LIKE adrc-city1,
           city2 LIKE adrc-city2,
           country LIKE adrc-country,
           street LIKE adrc-street,
           str_suppl1 LIKE adrc-str_suppl1,
           str_suppl2 LIKE adrc-str_suppl2,
           str_suppl3 LIKE adrc-str_suppl3,
           vtext like tpart-vtext,
           ADRNP LIKE VBPA-ADRNP,
          SMTP_ADDR LIKE ADR6-SMTP_ADDR,
         END OF I_PARTNER.
    SELECT
    VBPA~VBELN
    vbpa~adrnr
    VBPA~PARVW
    VBPA~KUNNR
    VBPA~ADRNP
    TPART~VTEXT
    FROM VBPA AS VBPA
    INNER JOIN TPART AS TPART
    ON VBPAPARVW EQ TPARTPARVW
    AND SPRAS = SY-LANGU
    INTO CORRESPONDING FIELDS OF TABLE I_PARTNER
    WHERE
    VBPA~VBELN EQ S_VBELN.
    WRITE:/
      i_partner-adrnr         under         'ADDRESS NUMBER',
      i_partner-vbeln         UNDER         'Order-No',
      i_partner-parvw         UNDER         'Partner-Type',
      I_PARTNER-VTEXT         UNDER         'Partner-Type description',
      I_PARTNER-KUNNR         UNDER         'Partner-no'.
      ULINE.
    endloop.
    HERE I AM GETTING ALL THE POSSIBLE PARTNER TYPES.
    I WANT TO GET THE OUT PUT ONLY WHEN THE PARTNER TYPE S ARE  'SP'  'BP' AND 'SH'.
    PLEASE HELP.....

    Hi,
    Both the answers are correct... iam just writing the code u needed..
    ranges : gr_partner for tablename-fieldname.
    initialization.
    gr_partner-sign = 'I'.
    gr_partner-option = 'EQ'
    gr_partner-low = 'SP'
    append gr_partner.
    gr_partner-sign = 'I'.
    gr_partner-option = 'EQ'
    gr_partner-low = 'BP'
    append gr_partner.
    gr_partner-sign = 'I'.
    gr_partner-option = 'EQ'
    gr_partner-low = 'SH'
    append gr_partner.
    SELECT
    VBPA~VBELN
    vbpa~adrnr
    VBPA~PARVW
    VBPA~KUNNR
    VBPA~ADRNP
    TPART~VTEXT
    FROM VBPA AS VBPA
    INNER JOIN TPART AS TPART
    ON VBPAPARVW EQ TPARTPARVW
    AND SPRAS = SY-LANGU
    INTO CORRESPONDING FIELDS OF TABLE I_PARTNER
    WHERE
    VBPA~VBELN EQ S_VBELN
    and vbpa~parvw in gr_partner.
    Regards,
    Nagaraj

  • Please help regarding a PL/SQL Code for padding of digits

    I have a table named as EWT_POL_AGT_REL. There is column named PDT_AGENT_NBR present in this table. The data type of this column is
    VARCHAR2(8 byte). There are some records in with pdt_agent_nbr having 8 spaces and some starting with zero such as “08400”. So I want
    to do following things 1.)left-append a '0' in front of the existing 5 digit PDT_AGENT_NBR and make it to 8 digits 2) if the existing PDT_AGENT_NBR is already 8 digits, do nothing 3.) if it contains leading spaces then replace them by zero.
    Sceanrios
    if PDT_AGENT_NBR is " 12345" then i should get "00012345"
    if PDT_AGENT_NBR is "1234" then i should get "00001234"
    This table has nearly 180 million records hence an update query will not work. Instead a PL/SQL procedure needs to be developed.
    Please help me on this. Please

    This table has nearly 180 million records hence an update query will not work. Because..................?
    Instead a PL/SQL procedure needs to be developed.So you want it to be slower?

  • I have had problems syncing on my Windows XP computer and yesterday I got my laptop back with a virus removed and was able to sync.  Then I updated the operating system to 5.0 and now the restore won't work.  Please help!  I got error code 50.

    I have had problems syncing my iPhone 4 and my iPad on my Windows XP laptop.  My computer had a virus and spyware, but is now fixed.  I was then able to sync both phone and ipad, but when I tried to update to ios-5.0, the update worked, but the restore would not.  Now I don't know what to do with my phone.  Is there a way to get the restore to work, or should I set it up as a new phone.  I have lots of apps, etc. that I do not want to lose.

    Hello,
    Welcome to the HP Forums!
    I understand the IDT Audio driver is missing. I can help you get it back, but first I require the following information:
    1. The computer's model number. If you require assistance locating this information, please reference this website: Guide to finding your product number
    2. The computer's operating system. If you require assistance locating this information, please reference this website to determine your Windows operating system.
    3. Have you installed any new hardware on this computer, before the issue appeared?
    4. Have you installed any new software or drivers on this computer, before the issue appeared?
    Mario
    I worked on behalf of HP.

  • Please Help with my first jsp

    Hi, this may seem basic to you but i've frying my head with simple jsp. Any books i looked at only show code segments!
    All i want to do is create an html entry page with form fields for username, password, email address, send the information to a jsp page that validates the form entries and then stores the info in database, and be able to display the info stored in the db also.
    Any help or pointers would be appreciated, or links to good tutorials!
    Thanks in advance.....

    with this i am sending my own code :
    its a html page :
    <Script LANGUAGE="JavaScript" ></Script>
    <%@ page import="java.util.*" %>
    <%@ page import="java.lang.*" %>
    <html>
    <head>
    <title>Login</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="Microsoft Theme" content="expeditn 011">
    </head>
    <body background="exptextb.jpg" bgcolor="#FFFFFF" text="#000000" link="#993300" vlink="#666600" alink="#CC3300">
    <!--mstheme--><font face="Book Antiqua, Times New Roman, Times">
    <form name="frmlogin" method="post">
    <p> 
    </p>
    <p> 
    </p>
    <p> 
    </p>
    <p> 
    </p>
    <p>                                                       
    User Name : 
    <input type="text" name="txtname">
    <br>
    <br>
    Password   : 
    <input type="password" name="txtpassword">
    </p>
    <p>                                                                    
    <input type="submit" name="submit" value="Submit" onclick="javascript: return loadmy('sub')">
    </p>
    </form>
    <script>
    var i=0;
    function loadmy(val)
              if(val=="new")
                   document.frmlogin.action='form.jsp';          
              }else
                   if(onCheck())
                        document.frmlogin.action='login.jsp';
                   }else
                        return false;
    function onCheck()
         if(document.frmlogin.txtname.value=="")
              alert("Please enter user name ..");
              document.frmlogin.txtname.select();
              document.frmlogin.txtname.focus();
              return false;
         if( document.frmlogin.txtpassword.value=="")
              alert("Please enter password ..");
              document.frmlogin.txtpassword.select();
              document.frmlogin.txtpassword.focus();
              return false;
         return true;
    </script>
    <p> </p><!--mstheme--></font></body>
    </html>
    IN this page i am taking user name and password. ok?
    now another JSP file with database connection is here: I think you have enough idea for database connection. So i'll ommit that.
    <html>
    <head>
    <title>Login Result Page</title>
    <meta name="Microsoft Theme" content="expeditn 011">
    </head>
    <%@ page import="java.lang.*,java.sql.*"%>
    <%@ page import ="Database.*" %>
    <body background="exptextb.jpg" bgcolor="#FFFFFF" text="#000000" link="#993300" vlink="#666600" alink="#CC3300">
    <!--mstheme--><font face="Book Antiqua, Times New Roman, Times">
    <%
         String uname = request.getParameter("txtname");
    String password = request.getParameter("txtpassword");
         String pquery="Select * from login where uname='"+uname+"'";
         String query="Select * from login where uname='"+uname+"'and password='"+password+"'";
         ClsDataBase cdb = new ClsDataBase();
         Connection con = cdb.getConnection();
         Statement stmt = con.createStatement();
         ResultSet rs = stmt.executeQuery(pquery);
         if(rs!=null)
              if(rs.next())
                   ResultSet r=stmt.executeQuery(query);
                   if(r!=null)
                        if(r.next())
                        session.setAttribute("uname",uname);
                        session.setAttribute("Lflag","true");
    %>
    <p><font size=4 color="green">Wel Come <%= uname %>!!!</font></p>
    <p>
    <form action="listofuser.jsp" method="post" name="f1">
    </form>
    <%                    }
                        else
    %>
    <p> <font size=4 color="red">Wrong Password.</font> </p>
    <p><font size="4" color="green">Go back to login screen</font></p>
    <%
              else
    %>
         <font size=4 color="red">Invalid user....</font>
         <p><font size="4" color="green">Go back to login screen</font></p>     
    <%
         stmt.close();
         cdb.close();
    // conn.close();
    %>
    <!--mstheme--></font>
    </body>
    </html>
    hope this will help you. bye....

Maybe you are looking for

  • NEED HELP: Problem with Canvas Size in Crystal design/report.

    Hello,      I am having some trouble with one of my reports, the canvas size is so much bigger than my design/report, which is causing it to preview really small.  I have gone into the document properties and tried to change those settings, I have al

  • Dealing with large files, again

    Ok, so I've looked into using BufferedReaders and can't get my head round them; or more specifically, I can't work out how to apply them to my code. I have inserted a section of my code below, and want to change it so that I can read in large files (

  • IOS 6 Apple Maps

    I just changed to ios 6. I live in Thailand. Ignoring the comments on Apple Maps in the internet, I thought I try it out. I am using an IPad 3 with German language. When calling Apple Maps, I noticed to my surprise, that all street names are placed i

  • Firmware update on 1 of our 2 Macbooks

    Did the firmware update on my Macbook and tried to burn 2 dvd-r back up discs (Sony) on my Macbook - both disc attempts failed on verification. (2.7 gig) A CDR burned fine. (400 meg) Went to my wife's Macbook, without the firmware update, put in the

  • Duplicate entries for contacts after BB update 10.2.1.2102

    Hi, This is in regards to my boss's blackberry q10. I recently updated the OS to 10.2.1.2102 (done via phone update not via BB link). After the update, i noticed that all contacts had a duplicate entry with only one of them containing the proper deta