Need help wrt query urgently

Hi ,
I have two tables "table1" and "table2".Structure of the both tables are below:
Table1:
CustomerId
CustFname
CustLname
Convertion_Date
Table2:
CustomerId
DFname
DLname
CustomerId is used for joins .
Now i need a query based on conversion_date.
If conversion_date <sysdate
then
select CustomerId ,CustFname,CustLname,Convertion_Date from Table1
else
select CustomerId,DFname,DLname from Table2
End .
I need this functionality in a single query using case statement.
Please help ..
Thanks,
Preethi MR

Preethi MR wrote:
Hi ,
I have two tables "table1" and "table2".Structure of the both tables are below:
Table1:
CustomerId
CustFname
CustLname
Convertion_Date
Table2:
CustomerId
DFname
DLname
CustomerId is used for joins .
Now i need a query based on conversion_date.
If conversion_date <sysdate
then
select CustomerId ,CustFname,CustLname,Convertion_Date from Table1
else
select CustomerId,DFname,DLname from Table2
End .
I need this functionality in a single query using case statement.
Please help ..
Thanks,
Preethi MRIs this urgent homework? Or urgent something else work?
What exactly makes it urgent?

Similar Messages

  • Need help wrt query

    Hi ,
    I have table A with below data :
    Name Sal
    Ram

    That's because it's over here:
    Need help wrt query

  • Need help in query urgent...............

    hi......
    i have the table with following structure.
    Table name : master
    id name v_value
    1 ashok 1
    2 balak 2
    3 kathir 4
    4 karan 8
    Input:
    6
    Need output
    id name v_value
    2 bala 2
    3 kathir 4
    Query like
    SELECT * FROM MASTER WHERE V_VALUE IN (<input value>) ;
    if given input value 6 means, how to split the value into 4 and 2....
    if given input value 12 means, how to split the value into 4,8....
    like wise.... for all the combinations..... for the above table values.
    if i give the input value 6 means, i need the query like
    select * from master where v_value in (2,4).
    is split the value is possible by user define function?
    like
    select * from master v_value in (userdefine_function(<input value>));
    if possible means give the function code.
    It is very urgent for my project....
    Thanks,
    S.Ashokkumar
    India.

    Ohh...you made it very simple. how can we accomplish
    the bitwise OR/XOR/...so on.They are all variations on the bitand:
    SQL> var P1 number
    SQL> var P2 number
    SQL> exec :P1 := 4;
    PL/SQL-procedure is geslaagd.
    SQL> exec :P2 := 6;
    PL/SQL-procedure is geslaagd.
    SQL> select :P1 + :P2 - bitand(:P1,:P2) bitor from dual
      2  /
                                     BITOR
                                         6
    SQL> select :P1 + :P2 - 2 * bitand(:P1,:P2) bitxor from dual
      2  /
                                    BITXOR
                                         2
    SQL> exec :P1 := 3;
    PL/SQL-procedure is geslaagd.
    SQL> exec :P2 := 32;
    PL/SQL-procedure is geslaagd.
    SQL> select :P1 + :P2 - bitand(:P1,:P2) bitor from dual
      2  /
                                     BITOR
                                        35
    SQL> select :P1 + :P2 - 2 * bitand(:P1,:P2) bitxor from dual
      2  /
                                    BITXOR
                                        35Regards,
    Rob.

  • Need help in query-Urgent Please

    Hi I have the following requrement.
    select x from t.
    1
    2
    3
    4
    I have to insert all the distict combinations in two columns of another table. the oytpu shd be like below
    select * from b;
    1 2
    1 3
    1 4
    2 1
    2 3
    2 4
    3 1
    3 2
    3 4
    4 1
    4 2
    4 3
    I can write a query like below.
    create table b as select t1.x,t2.x from a t1, a t2 where t1.x<>t2.x;
    But the problem is my table Has 250 million records or even more than that.
    Pls suggest the most efficient way.

    SQL> WITH yourtable AS
      2   (
      3     SELECT 1 x FROM dual UNION ALL
      4     SELECT 2 x FROM dual UNION ALL
      5     SELECT 3 x FROM dual UNION ALL
      6     SELECT 4 x FROM dual
      7   )
      8  SELECT a.x
      9       , b.x
    10  FROM   yourtable a
    11     ,   yourtable b
    12  WHERE a.x != b.x
    13  ORDER BY 1, 2
    14  /
             X          X
             1          2
             1          3
             1          4
             2          1
             2          3
             2          4
             3          1
             3          2
             3          4
             4          1
             4          2
             4          3
    12 rows selected.
    SQL>

  • Need Help to query Lync Database for User Information

    Need Help to Query the lync database to retrieve below user information.
    1. SIP Address of the registered user
            2. Phone Number configured to the particular account.
            3. IP Address
           4. Last Logged in time.
    I am trying to pull the above information from rtc database for all the registered users. Please let me know if this is possible and it would be great if you can throw some light on what tables to look for the data. Thank You.

    Hi,
    For SIP address and Phone number you can check RTC database.
    IP Address:
    You can refer to the link below to query IP address: 
    http://h30499.www3.hp.com/t5/Business-Service-Management-BAC/Monitoring-Lync-with-the-User-Registrations-Viewer-Free-NMC-tool/ba-p/5961497#.UtOU43mIrwo
    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.
    Please make sure that you completely understand the risk before retrieving any suggestions from the above link.
    Last Logged in time:
    You can refer to the link below:
    http://blogs.technet.com/b/dodeitte/archive/2011/05/11/how-to-get-the-last-time-a-user-registered-with-a-front-end.aspx
    Best Regards,
    Eason Huang
    Eason Huang
    TechNet Community Support

  • Need a SQL Query (URGENT)

    Hi Folks,
    I have 2 tables, in which the 1st one has 200 columns and 2 table had 2 columns.. There is one common column for both the tables, but there is little change in schema of the tables...The common col in 2nd table is a primary key but the same column in the 1st table is a ordinary one..The data type for the common column is same...
    Now i need to write a query to select 199columns(except the common column)from the 1st table and the other column(2nd col)other than the common column frm the 2nd table for "table1.commoncolumn=table2.commoncolumn"......
    I had tried the natural join but its nt working in my informix sql database....I also tried by explicitly mentioning column names like "select column1,column2....column199,table2.column2 from table1,table2 where table1.commoncolumn=table2.commoncolumn", but its having a severe performance impact.......
    Can some please suggest a query for the above one?? Thankx in advance..

    Please gimme possible solutions & suggestions regarding the above query....
    The informix z forum very slow...The problem is, you labeled your questions badly. As this is a forum of volunteers people tend to react badly to the use of the word "urgent" in the subject line. Nobody's question matters more than anybody else's. In fact some regulars won't answer questions with "urgent" in the strapline as a matter of principle.
    Then when we get to actually read your question it turns out to be a question about Informix. I guess not many people here use Informix so your potential pool of responders is pretty small (for instance I'm not even sure how to spell it).
    It's not our fault the Informix forums are so lame.
    Anyway, what I suggest is you repost your question with a new title: (Off topic) Need help with an INFORMIX query.
    At least that will attract people who might be able to answer your question. Then you need to include the actual query you're running and all the supporting details necessary for people to understand the nature of the performance impact.
    You need to ask the right people and you need to ask the right question. This is standard etiquette (and indeed common sense) regardless of which forum you're using.
    Cheers, APC
    Blog : http://radiofreetooting.blogspot.com/

  • Need help with Query

    Hi,
    Good day everyone! I need help writing a query. I have this table with the following data in them...
    ACCT_CODE  FSYR      YTD_AMT
    A123            11          100  
    A456            11          200
    A123            10          50
    A456            10          100I want the output to look like this:
    ACCT_CODE     CURRENT_YEAR(11)       PRIOR_YEAR(10)
    A123               100                              50
    A456               200                              100The user will input the fiscal year and based on that input, I want to get the prior year value as well.
    Thank you for all your help!!
    Edited by: user5737516 on Jun 29, 2011 6:48 AM
    Edited by: user5737516 on Jun 29, 2011 6:50 AM

    user5737516 wrote:
    Hi,
    Good day everyone! I need help writing a query. I have this table with the following data in them...
    ACCT_CODE FSYR YTD_AMT
    A123 11 100
    A456 11 200
    A123 10 50
    A456 10 100
    I want the output to look like this:
    ACCT_CODE CURRENT_YEAR PRIOR_YEAR
    A123 100 50
    A456 200 100
    The user will input the fiscal year and based on that input, I want to get the prior year value as well.
    Thank you for all your help!!what is prior year?

  • Java using GUI's mixed with opengl... needs help...urgent....

    guys, i need help.... is anyone there have an idea about opengl...? ill attach 4 files that needs to be enhanced or debug for possible errors. to see the canvas... you should have atleast all the needed lib and jar of opengl in your pc.
    its urgent, its for our thesis actually....ill be dividing the codes with the use of (" **** ")sign...
    * Main.java
    * Created on 29 January 2007, 08:12
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package longgong;
    * @author welcome
    public class Main {
        /** Creates a new instance of Main */
        public Main() {
         * @param args the command line arguments
        public static void main(String[] args) {
            // TODO code application logic here
            frmMain f = new frmMain();
    * frmMain.java
    * Created on November 10, 2006, 10:52 AM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package longgong; // create a floder named longgong and add the class inside
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    * @author all user
    public class frmMain extends JFrame implements ActionListener, ChangeListener, ItemListener{
        JPanel pnlWest, pnlEast, pnlCenter, pnlSouth, pnlTitle, pnlSlider, pnlPlayers;
        JSlider slrSpeed;
        JList lstResults;
        String varResults [] = new String[31];
        JLabel lblPlayers, lblTitle;
        JCheckBox lblPlayer1, lblPlayer2, lblPlayer3, lblPlayer4, lblPlayer5, lblPlayer6;
        ImageIcon imgDice1;
        MyCanvas canvas;
        JButton btnStart, btnStop;
        JMenuBar menuBar;
        JMenu menuFile, menuView, menuHelp;
        JMenuItem menuNew, menuExit, menuIn, menuOut, menuHigh, menuPlay, menuAbout;
        boolean isNew = false;
        /** Creates a new instance of frmMain */
        public frmMain() {
            setLayout(new BorderLayout());
            setTitle("Longgong");
            setSize(780,600);
            canvas = new MyCanvas(getSize().width, getSize().height);
            imgDice1 = new ImageIcon("c:\\java\\images\\one.png");
            menuBar = new JMenuBar();
            menuFile = new JMenu("File");
            menuView = new JMenu("View");
            menuHelp = new JMenu("Help");
            menuNew = new JMenuItem ("New Game");
            menuNew.addActionListener(this);
            menuExit = new JMenuItem ("Exit");
            menuExit.addActionListener(this);
            menuIn = new JMenuItem ("Zoom In");
            menuIn.addActionListener(this);
            menuOut = new JMenuItem ("Zoom Out");
            menuOut.addActionListener(this);
            menuHigh = new JMenuItem ("High Score");
            menuPlay = new JMenuItem ("How To Play");
            menuPlay.addActionListener(this);
            menuAbout = new JMenuItem ("About");
            menuAbout.addActionListener(this);
            menuFile.add(menuNew);
            menuFile.add(menuExit);
            menuView.add(menuIn);
            menuView.add(menuOut);
            menuView.add(menuHigh);
            menuHelp.add(menuPlay);
            menuHelp.add(menuAbout);
            menuBar.add(menuFile);
            menuBar.add(menuView);
            menuBar.add(menuHelp);
            setJMenuBar(menuBar);
            varResults[0] = "Dice Results";
            varResults[1] = "1. 3-4-2";
            varResults[2] = "2. 3-1-4";
            varResults[3] = "3. 3-6-5";
            slrSpeed = new JSlider(0, 100, 0);
            slrSpeed.setPaintTicks(true);
            slrSpeed.setMinorTickSpacing(1);
            slrSpeed.setPaintLabels(true);
            slrSpeed.setSnapToTicks(true);
            slrSpeed.addChangeListener(this);
            slrSpeed.setEnabled(false);
            btnStart =  new JButton("Start");
            btnStart.addActionListener(this);
            btnStop =  new JButton("Stop");
            btnStop.addActionListener(this);
            pnlWest = new JPanel();
            pnlEast = new JPanel();
            pnlCenter = new JPanel();
            pnlSouth = new JPanel();
            pnlTitle = new JPanel();
            pnlSlider = new JPanel();       
            pnlPlayers = new JPanel();
            pnlWest.setLayout(new BorderLayout());
            pnlEast.setLayout(new BorderLayout());
            pnlEast.setPreferredSize(new Dimension(100,400));
            pnlCenter.setLayout(new BorderLayout());
            pnlSouth.setLayout(new FlowLayout());
            pnlTitle.setLayout(new FlowLayout());
            pnlSlider.setLayout(new FlowLayout());       
            pnlPlayers.setLayout(new BoxLayout(pnlPlayers,BoxLayout.Y_AXIS));
            pnlPlayers.setPreferredSize(new Dimension(150,400));
            lblPlayers = new JLabel("  Players: Choice (s)");
            lblPlayer1 = new JCheckBox("None");
            lblPlayer1.addItemListener(this);
            lblPlayer2 = new JCheckBox("None");
            lblPlayer2.addItemListener(this);
            lblPlayer3 = new JCheckBox("None");
            lblPlayer3.addItemListener(this);
            lblPlayer4 = new JCheckBox("None");
            lblPlayer4.addItemListener(this);
            lblPlayer5 = new JCheckBox("None");
            lblPlayer5.addItemListener(this);
            lblPlayer6 = new JCheckBox("None");
            lblPlayer6.addItemListener(this);
            lstResults = new JList(varResults);
            pnlPlayers.add(lblPlayers);
            pnlPlayers.add(lblPlayer1);
            pnlPlayers.add(lblPlayer2);
            pnlPlayers.add(lblPlayer3);
            pnlPlayers.add(lblPlayer4);
            pnlPlayers.add(lblPlayer5);
            pnlPlayers.add(lblPlayer6);
            pnlSlider.add(slrSpeed);
            pnlSlider.add(btnStart);
            pnlSlider.add(btnStop);
            pnlEast.add(BorderLayout.CENTER, lstResults);
            pnlCenter.add(BorderLayout.SOUTH, pnlSlider);    
            pnlCenter.add(BorderLayout.CENTER, canvas);    
            lblTitle = new JLabel("LONGGONG DICE GAME SIMULATION");
            pnlTitle.add(lblTitle);
            getContentPane().add(BorderLayout.NORTH,pnlTitle);   
            getContentPane().add(BorderLayout.WEST,pnlPlayers);
            getContentPane().add(BorderLayout.EAST,pnlEast);
            getContentPane().add(BorderLayout.CENTER, pnlCenter);
            getContentPane().add(BorderLayout.SOUTH,pnlSouth);
            setResizable(false);
            canvas.start();
            show();       
        //name change when player is selected
        public void itemStateChanged(ItemEvent e) {
        Object source = e.getItemSelectable();
        int choice;
        if (source == lblPlayer1) {
            if (lblPlayer1.isSelected()) {
                frmChoices fchoices = new frmChoices(lblPlayer1);
        if (source == lblPlayer2) {
            if (lblPlayer2.isSelected()) {
                frmChoices fchoices = new frmChoices(lblPlayer2);
        if (source == lblPlayer3) {
            if (lblPlayer3.isSelected()) {
                frmChoices fchoices = new frmChoices(lblPlayer3);
        if (source == lblPlayer4) {
            if (lblPlayer4.isSelected()) {
                frmChoices fchoices = new frmChoices(lblPlayer4);
        if (source == lblPlayer5) {
            if (lblPlayer5.isSelected()) {
                frmChoices fchoices = new frmChoices(lblPlayer5);
        if (source == lblPlayer6) {
            if (lblPlayer6.isSelected()) {
                frmChoices fchoices = new frmChoices(lblPlayer6);
           // if (e.getStateChange() == ItemEvent.DESELECTED)
            //...make a note of it...
        //slider speed change
        public void stateChanged(ChangeEvent e){      
               canvas.speed(slrSpeed.getValue());
        public void actionPerformed (ActionEvent e){
            if (e.getActionCommand().equals ("Exit")){
                System.exit (0);     
            //connects to frmNew
            if (e.getActionCommand().equals ("New Game")){
                frmNew n = new frmNew(this);   
                lblPlayer1.setText("None");
                lblPlayer2.setText("None");
                lblPlayer3.setText("None");
                lblPlayer4.setText("None");
                lblPlayer5.setText("None");
                lblPlayer6.setText("None");
                isNew = true;
                lblPlayer1.setSelected(false);
                lblPlayer2.setSelected(false);
                lblPlayer3.setSelected(false);
                lblPlayer4.setSelected(false);
                lblPlayer5.setSelected(false);
                lblPlayer6.setSelected(false);
            if (e.getActionCommand().equals ("Start")){
               slrSpeed.setEnabled(true);
               canvas.setRandomDicePosition();
            if (e.getActionCommand().equals ("Stop")){
                slrSpeed.setValue(0);
                slrSpeed.setEnabled(false);
            //ADDED
             if (e.getActionCommand().equals ("New Game")){
               frmNew n = new frmNew(this);           
            if (e.getActionCommand().equals ("Zoom In")){
                canvas.zoomIn();          
            if (e.getActionCommand().equals ("Zoom Out")){
                canvas.zoomOut();          
            if (e.getActionCommand().equals ("How To Play")){
                frmPlay p = new frmPlay();           
            if (e.getActionCommand().equals ("About")){
                frmAbout a = new frmAbout();           
    package longgong;
    // Java  classes
       import java.awt.*;
       import java.awt.event.*;
       import java.net.URL;
    // GL4Java classes
       import gl4java.GLContext;
       import gl4java.awt.GLAnimCanvas;
       import gl4java.utils.textures.*;
       class MyCanvas extends GLAnimCanvas implements KeyListener, MouseListener
         // holds information on which keys are held down.
          boolean[] keys=new boolean[256];
          float     xrot;                    // X Rotation ( NEW )
          float     yrot;                    // Y Rotation ( NEW )
          float     zrot;                    // Z Rotation ( NEW )
          float[] diceRotX = new float[3];
          float[] diceRotY = new float[3];
          float[] diceRotZ = new float[3];
          float[] diceTranX = new float[3];
          float[] diceTranY = new float[3];
          float[] diceTranZ = new float[3];     
          float speedValue;
          Dice[] D;
          float zoom = -15.0f;
          public MyCanvas(int w, int h)
             super(w, h);
             //Registers this canvas to process keyboard events, and Mouse events
             addKeyListener(this);
             addMouseListener(this);  
             setAnimateFps(60); // seemed to be essential in getting any performance
             speedValue=0.0f;
             diceTranX[0] = -2.0f;
             diceTranY[0] = 2.0f;
             diceTranZ[0] = zoom;
             diceTranX[1] = 2.0f;
             diceTranY[1] = 1.0f;
             diceTranZ[1] = zoom;
             diceTranX[2] = 0.0f;
             diceTranY[2] = -2.0f;
             diceTranZ[2] = zoom;
          public void zoomIn(){
              zoom=zoom+1.0f;
           public void zoomOut(){
              zoom=zoom-1.0f;
          public void speed(float s){
            speedValue=s/100;
        /** void reshape(int width, int height) Called after the first paint command.  */  
          public void reshape(int width, int height)
             if(height==0)height=1;
             gl.glViewport(0, 0, width, height);                       // Reset The Current Viewport And Perspective Transformation
             gl.glMatrixMode(GL_PROJECTION);                           // Select The Projection Matrix
             gl.glLoadIdentity();                                      // Reset The Projection Matrix
             glu.gluPerspective(45.0f, width / height, 0.1f, 100.0f);  // Calculate The Aspect Ratio Of The Window
             gl.glMatrixMode(GL_MODELVIEW);                            // Select The Modelview Matrix
             gl.glLoadIdentity();                                      // Reset The ModalView Matrix     
       /** void preInit() Called just BEFORE the GL-Context is created. */  
          public void preInit()
          { doubleBuffer = true; stereoView = false; // buffering but not stereoview
          public void setRandomDicePosition(){
             for (int i=0; i<3; i++){
               D.setCoordinates(diceRotX[i],diceRotY[i],diceRotZ[i],diceTranX[i],diceTranY[i],diceTranZ[i]);
    D[i].getRandomDice();
    /** void init() Called just AFTER the GL-Context is created. */
    public void init()
    //float width = (float)getSize().width;
    //float height = (float)getSize().height;
    D = new Dice[5];
    D[0] = new Dice(this);
    D[1] = new Dice(this);
    D[2] = new Dice(this);
    //initialize dice location
    for (int i=0; i<3; i++){
    D[i].setCoordinates(diceRotX[i],diceRotY[i],diceRotZ[i],diceTranX[i],diceTranY[i],diceTranZ[i]);
    D[i].getRandomDice();
    gl.glEnable(GL_TEXTURE_2D);                              //Enable Texture Mapping ( NEW )
    gl.glShadeModel(GL_SMOOTH); //Enables Smooth Color Shading
    gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); //This Will Clear The Background Color To Black
    gl.glClearDepth(1.0); //Enables Clearing Of The Depth Buffer
    gl.glEnable(GL_DEPTH_TEST); //Enables Depth Testing
    gl.glDepthFunc(GL_LEQUAL); //The Type Of Depth Test To Do
    gl.glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); //Really Nice Perspective Calculations
    public void DrawBoundaries(){
    double x,y;
    double radius = 5.0f;
    gl.glLoadIdentity();                                             // Reset The View
    gl.glTranslatef(0.0f,0.0f,zoom-1.0f);
    gl.glRotatef(90.0f,0.0f,0.0f,1.0f);
    gl.glColor3f(0.6f,0.3f,0.3f);
    gl.glBegin(gl.GL_POLYGON);
    // angle is
    // x = radius * (cosine of angle)
    // y = radius * (sine of angle)
    for (double a=0; a<360; a++) {
    x = radius * (Math.cos(a));
    y = radius * (Math.sin(a));
    gl.glVertex3d(x, y, 0.0f);
    gl.glEnd();
    gl.glColor3f(1.0f,1.0f,1.0f);
    public void DrawGLScene()
    gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);     // Clear The Screen And The Depth Buffer
    DrawBoundaries();
    for (int i=0; i<3; i++){
    D[i].startDiceMovement();
    D[i].setTz(zoom);
    D[i].setSpeed(speedValue);
    D[i].drawDice();
    for (int i=0; i<3; i++){
    //start of loop
    if(i!=0){    
    if (D[0].getMoveLeft()==true){        
    if ( (D[0].getTx()>=D[i].getTx()-1.0f) && (D[0].getTx()<=D[i].getTx()) ){
    if (D[0].getMoveLeft()== true) D[0].setMoveLeft(false);
    else D[0].setMoveLeft(true);
    }else{
    if ( (D[0].getTx()-1<=D[i].getTx()) && (D[0].getTx()-1>=D[i].getTx()-1) ){
    if (D[0].getMoveLeft()== true) D[0].setMoveLeft(false);
    else D[0].setMoveLeft(true);
    if (D[0].getMoveUp()==true){        
    if ( (D[0].getTy()>=D[i].getTy()-1.0f) && (D[0].getTy()<=D[i].getTy()) ){
    if (D[0].getMoveUp()== true) D[0].setMoveUp(false);
    else D[0].setMoveUp(true);
    }else{
    if ( (D[0].getTy()-1<=D[i].getTy()) && (D[0].getTy()-1>=D[i].getTy()-1) ){
    if (D[0].getMoveUp()== true) D[0].setMoveUp(false);
    else D[0].setMoveUp(true);
    }//end of if i!=0
    if(i!=1){    
    if (D[1].getMoveLeft()==true){        
    if ( (D[1].getTx()>=D[i].getTx()-1.0f) && (D[1].getTx()<=D[i].getTx()) ){
    if (D[1].getMoveLeft()== true) D[1].setMoveLeft(false);
    else D[1].setMoveLeft(true);
    }else{
    if ( (D[1].getTx()-1<=D[i].getTx()) && (D[1].getTx()-1>=D[i].getTx()-1) ){
    if (D[1].getMoveLeft()== true) D[1].setMoveLeft(false);
    else D[1].setMoveLeft(true);
    if (D[1].getMoveUp()==true){        
    if ( (D[1].getTy()>=D[i].getTy()-1.0f) && (D[1].getTy()<=D[i].getTy()) ){
    if (D[1].getMoveUp()== true) D[1].setMoveUp(false);
    else D[1].setMoveUp(true);
    }else{
    if ( (D[1].getTy()-1<=D[i].getTy()) && (D[1].getTy()-1>=D[i].getTy()-1) ){
    if (D[1].getMoveUp()== true) D[1].setMoveUp(false);
    else D[1].setMoveUp(true);
    }//end of if i!=1
    if(i!=2){    
    if (D[2].getMoveLeft()==true){        
    if ( (D[2].getTx()>=D[i].getTx()-1.0f) && (D[2].getTx()<=D[i].getTx()) ){
    if (D[2].getMoveLeft()== true) D[2].setMoveLeft(false);
    else D[2].setMoveLeft(true);
    }else{
    if ( (D[2].getTx()-1<=D[i].getTx()) && (D[2].getTx()-1>=D[i].getTx()-1) ){
    if (D[2].getMoveLeft()== true) D[2].setMoveLeft(false);
    else D[2].setMoveLeft(true);
    if (D[2].getMoveUp()==true){        
    if ( (D[2].getTy()>=D[i].getTy()-1.0f) && (D[2].getTy()<=D[i].getTy()) ){
    if (D[2].getMoveUp()== true) D[2].setMoveUp(false);
    else D[2].setMoveUp(true);
    }else{
    if ( (D[2].getTy()-1<=D[i].getTy()) && (D[2].getTy()-1>=D[i].getTy()-1) ){
    if (D[2].getMoveUp()== true) D[2].setMoveUp(false);
    else D[2].setMoveUp(true);
    }//end of if i!=2
    //end of loop for i
    /** void display() Draw to the canvas. */
    // Purely a Java thing. Simple calls DrawGLScene once GL is Initialized
    public void display()
    for(int i=0;i<3;i++){
    glj.gljMakeCurrent(); //Ensure GL is initialised correctly
    DrawGLScene();
    glj.gljSwap(); //Swap buffers
    glj.gljFree(); // release GL
    // Key Listener events
    public void keyTyped(KeyEvent e){
    public void keyPressed(KeyEvent e){
    switch(e.getKeyCode())
    //Kill app
    case KeyEvent.VK_ESCAPE:
    System.exit(0);
    break;
    default :
    if(e.getKeyCode()<250) // only interested in first 250 key codes, are there more?
    keys[e.getKeyCode()]=true;     
    break;
    public void keyReleased(KeyEvent e){
    if(e.getKeyCode()<250) // only interested in first 250 key codes, are there more?
    keys[e.getKeyCode()]=false;
    // mouse listener events
    public void mouseEntered( MouseEvent evt )
    Component comp = evt.getComponent();
    if( comp.equals(this ) )
    //requestFocus();
    public void mouseExited( MouseEvent evt ){
    public void mousePressed( MouseEvent evt ){
    public void mouseReleased( MouseEvent evt ){
    public void mouseClicked( MouseEvent evt )
    Component comp = evt.getComponent();
    if( comp.equals(this ) )
    requestFocus();
    * Dice.java
    * Created on 08 February 2007, 22:26
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package longgong;
    import java.net.URL;
    import gl4java.GLContext;
    import gl4java.awt.GLAnimCanvas;
    import gl4java.utils.textures.*;
    * @author welcome
    public class Dice {
          GLAnimCanvas glCanvas ;
          URL codeBase;
          int[]texture1 = new int[1]; //Storage for one texture ( NEW )    
          int[]texture2 = new int[1]; //Storage for one texture ( NEW )    
          int[]texture3 = new int[1]; //Storage for one texture ( NEW )    
          int[]texture4 = new int[1]; //Storage for one texture ( NEW )    
          int[]texture5 = new int[1]; //Storage for one texture ( NEW )    
          int[]texture6 = new int[1]; //Storage for one texture ( NEW )    
          float rx;
          float ry;
          float rz;
          float tx;
          float ty;
          float tz;
          float speed;
          boolean txMoveLeft;
          boolean tyMoveUp;
          boolean tzMoveFront;
        /** Creates a new instance of Dice */
        public Dice(GLAnimCanvas g) {
            glCanvas = g;       
            if(!LoadGLTexture("c:\\java\\images\\one.png",texture1)){
                System.out.println("Failed to load Textures,Bailing!");
                System.exit(0);
            if(!LoadGLTexture("c:\\java\\images\\two.png",texture2)){
                System.out.println("Failed to load Textures,Bailing!");
                System.exit(0);
            if(!LoadGLTexture("c:\\java\\images\\three.png",texture3)){
                System.out.println("Failed to load Textures,Bailing!");
                System.exit(0);
            if(!LoadGLTexture("c:\\java\\images\\four.png",texture4)){
                System.out.println("Failed to load Textures,Bailing!");
                System.exit(0);
            if(!LoadGLTexture("c:\\java\\images\\five.png",texture5)){
                System.out.println("Failed to load Textures,Bailing!");
                System.exit(0);
            if(!LoadGLTexture("c:\\java\\images\\six.png",texture6)){
                System.out.println("Failed to load Textures,Bailing!");
                System.exit(0);
            txMoveLeft = true;
            tyMoveUp = true;
         public boolean inCircleBoundaries(float x, float y, float radius)
            float r;       
            r = (float)Math.sqrt((x*x) + (y*y));
            if (r <= radius)
                return  true;
            else
                return false;
        public void setCoordinates(float corRx,float corRy,float corRz,float corTx,float corTy,float corTz){
            rx = corRx;
            ry = corRy;
            rz = corRz;
            tx = corTx;
            ty = corTy;
            tz = corTz;
        public void getRandomDice(){
            int num = (int)(Math.random() * 6);
            if (num==1){
                rx=0.0f;
                ry=0.0f;
                rz=0.0f;
            else if (num==2){
                rx=90.0f;
                ry=0.0f;
                rz=0.0f;
            else if (num==3){
                rx=0.0f;
                ry=-90.0f;
                rz=0.0f;
            else if (num==4){
                rx=0.0f;
                ry=90.0f;
                rz=0.0f;
            else if (num==5){
                rx=-90.0f;
                ry=0.0f;
                rz=0.0f;
            else{
                rx=180.0f;
                ry=0.0f;
                rz=0.0f;
        public float getTx(){
            return tx+0.5f;
        public float getTy(){
            return ty+0.5f;
        public float getTz(){
            return tz+0.5f;
        public void setTz(float z){
            tz=z;
        public boolean getMoveLeft(){
            return txMoveLeft;
        public boolean getMoveUp(){
            return tyMoveUp;
        public void setMoveLeft(boolean m){
            txMoveLeft = m;
        public void setMoveUp(boolean m){
            tyMoveUp = m;
        public void startDiceMovement(){    
            if (txMoveLeft==true) {
                tx+=speed;           
            else {
                tx-=speed;
            if (tyMoveUp==true) {
                ty+=speed;
            else {
                ty-=speed;
            ry+=(speed*4);
            rx+=(speed*4);
            //rz+=(speed*2);
            //tx+=speed;
            //ty+=speed;
            //tz+=speed;             
         if (inCircleBoundaries(tx,ty,3.5f)==false) {  
            if (tx>=3.0f) txMoveLeft = false;
            if (tx<=-3.0f) txMoveLeft = true;
            if (ty>=3.0f) tyMoveUp = false;
            if (ty<=-3.0f) tyMoveUp = true;
        public void setSpeed(float s){
            speed = s;
         public void drawDice(){        
             glCanvas.gl.glLoadIdentity();                                             // Reset The View
             glCanvas.gl.glTranslatef(tx,ty,tz);
             glCanvas.gl.glRotatef(rx,1.0f,0.0f,0.0f);
             glCanvas.gl.glRotatef(ry,0.0f,1.0f,0.0f);
             glCanvas.gl.glRotatef(rz,0.0f,0.0f,1.0f);
             glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, texture1[0]);        
             glCanvas.gl.glBegin(glCanvas.gl.GL_QUADS);        
                // Front Face
             glCanvas.gl.glTexCoord2f(0.0f, 0.0f); glCanvas.gl.glVertex3f(-1.0f, -1.0f,  1.0f);
             glCanvas.gl.glTexCoord2f(1.0f, 0.0f); glCanvas.gl.glVertex3f( 1.0f, -1.0f,  1.0f);
             glCanvas.gl.glTexCoord2f(1.0f, 1.0f); glCanvas.gl.glVertex3f( 1.0f,  1.0f,  1.0f);
             glCanvas.gl.glTexCoord2f(0.0f, 1.0f); glCanvas.gl.glVertex3f(-1.0f,  1.0f,  1.0f);
             glCanvas.gl.glEnd();
             glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, texture6[0]);
             glCanvas.gl.glBegin(glCanvas.gl.GL_QUADS);        
               // Back Face          
             glCanvas.gl.glTexCoord2f(1.0f, 0.0f); glCanvas.gl.glVertex3f(-1.0f, -1.0f, -1.0f);
             glCanvas.gl.glTexCoord2f(1.0f, 1.0f); glCanvas.gl.glVertex3f(-1.0f,  1.0f, -1.0f);
             glCanvas.gl.glTexCoord2f(0.0f, 1.0f); glCanvas.gl.glVertex3f( 1.0f,  1.0f, -1.0f);
             glCanvas.gl.glTexCoord2f(0.0f, 0.0f); glCanvas.gl.glVertex3f( 1.0f, -1.0f, -1.0f);
             glCanvas.gl.glEnd();
             glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, texture2[0]);
             glCanvas.gl.glBegin(glCanvas.gl.GL_QUADS);        
                // Top Face
             glCanvas.gl.glTexCoord2f(0.0f, 1.0f); glCanvas.gl.glVertex3f(-1.0f,  1.0f, -1.0f);
             glCanvas.gl.glTexCoord2f(0.0f, 0.0f); glCanvas.gl.glVertex3f(-1.0f,  1.0f,  1.0f);
             glCanvas.gl.glTexCoord2f(1.0f, 0.0f); glCanvas.gl.glVertex3f( 1.0f,  1.0f,  1.0f);
             glCanvas.gl.glTexCoord2f(1.0f, 1.0f); glCanvas.gl.glVertex3f( 1.0f,  1.0f, -1.0f);
             glCanvas.gl.glEnd();
             glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, texture5[0]);
             glCanvas.gl.glBegin(glCanvas.gl.GL_QUADS);        
                // Bottom Face
             glCanvas.gl.glTexCoord2f(1.0f, 1.0f); glCanvas.gl.glVertex3f(-1.0f, -1.0f, -1.0f);
             glCanvas.gl.glTexCoord2f(0.0f, 1.0f); glCanvas.gl.glVertex3f( 1.0f, -1.0f, -1.0f);
             glCanvas.gl.glTexCoord2f(0.0f, 0.0f); glCanvas.gl.glVertex3f( 1.0f, -1.0f,  1.0f);
             glCanvas.gl.glTexCoord2f(1.0f, 0.0f); glCanvas.gl.glVertex3f(-1.0f, -1.0f,  1.0f);
             glCanvas.gl.glEnd();
             glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, texture3[0]);
             glCanvas.gl.glBegin(glCanvas.gl.GL_QUADS);        
                // Right face
             glCanvas.gl.glTexCoord2f(1.0f, 0.0f); glCanvas.gl.glVertex3f( 1.0f, -1.0f, -1.0f);
             glCanvas.gl.glTexCoord2f(1.0f, 1.0f); glCanvas.gl.glVertex3f( 1.0f,  1.0f, -1.0f);
             glCanvas.gl.glTexCoord2f(0.0f, 1.0f); glCanvas.gl.glVertex3f( 1.0f,  1.0f,  1.0f);
             glCanvas.gl.glTexCoord2f(0.0f, 0.0f); glCanvas.gl.glVertex3f( 1.0f, -1.0f,  1.0f);
             glCanvas.gl.glEnd();
             glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, texture4[0]);
             glCanvas.gl.glBegin(glCanvas.gl.GL_QUADS);        
                // Left Face
             glCanvas.gl.glTexCoord2f(0.0f, 0.0f); glCanvas.gl.glVertex3f(-1.0f, -1.0f, -1.0f);
             glCanvas.gl.glTexCoord2f(1.0f, 0.0f); glCanvas.gl.glVertex3f(-1.0f, -1.0f,  1.0f);
             glCanvas.gl.glTexCoord2f(1.0f, 1.0f); glCanvas.gl.glVertex3f(-1.0f,  1.0f,  1.0f);
             glCanvas.gl.glTexCoord2f(0.0f, 1.0f); glCanvas.gl.glVertex3f(-1.0f,  1.0f, -1.0f);
             glCanvas.gl.glEnd();
          public boolean LoadGLTexture(String fileName, int textureNumber[])
             PngTextureLoader texLoader = new PngTextureLoader(glCanvas.gl, glCanvas.glu);
             if(codeBase!=null)  
                texLoader.readTexture(codeBase, fileName);
             else
                texLoader.readTexture(fileName);
             if(texLoader.isOk())
                //Create Texture
                glCanvas.gl.glGenTextures(1, textureNumber);
                glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, textureNumber[0]);
                glCanvas.gl.glTexParameteri(glCanvas.gl.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

    ill attach 4 files that needs to be
    enhanced or debug for possible errors. i hate to break it to you, but even if you post this for the seventh time, finding and fixing errors in your code remains your task.

  • Need help in query tuning

    Hi All,
    In my application I have 3 tables. Event(1.2 L records), KeyWord(1K records) and Event_KeyWord_Mapping(1.4 L records) table.
    In my query i need to sort the Events table by 3 columns -( 1 Date column and 2 String column) and i am interested only in top 40 records.
    Below is the example query.
    select
        from
            (    select
                      a.*,
                ROWNUM    
            from
                (    select
                    distinct event_id   
                from
                    (     select
                        (this_.EVENT_ID),
                        this_.EVENT_GMT_DATE ,
                        this_.PRIORITY    
                    from
                        EVENTS this_,
                        event_keyword_mapping ekp 
                    where
                        this_.EVENT_ID = ekp.event_id
                        AND  ekp.keyword_id IN (
                            1643,2278,24,1090,2422,401 )
                        AND (
                                EVENT_CODE = 'IEP'
                                AND (
                                    IS_SCALL = 'Y'
                                    AND  COUNTRY_DISPLAY IN (
                                        'US','CA','UK','BE','FR','DE','IT','JP','AU','CH','EU'
                        OR (
                                EVENT_CODE = 'ICC'
                                AND IS_GTINDEX = 'Y'
                        AND  FX_EVENT = 'N' 
                        AND  EVENT_GMT_DATE BETWEEN to_date('12/27/2011 05:14:00','mm/dd/yyyy HH24:MI:SS')and
    to_date('03/27/2012 10:28:44','mm/dd/yyyy HH24:MI:SS')
                    ORDER BY
                        EVENT_GMT_DATE ASC  ,
                        PRIORITY ASC  ,
                        EVENT_ID ASC )) a 
                where
                    ROWNUM<=41)(1643,2278,24,1090,2422,401) keywords have 90K+ mappings.
    Below is the explain plan for the above query.
    | Id  | Operation                               | Name                           | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |                                                                                                                                                                         
    |   0 | SELECT STATEMENT                        |                                |    41 |  1066 |       |   629K (85)| 02:05:51 |                                                                                                                                                                         
    |   1 |  VIEW                                   |                                |    41 |  1066 |       |   629K (85)| 02:05:51 |                                                                                                                                                                         
    |*  2 |   COUNT STOPKEY                         |                                |       |       |       |            |          |                                                                                                                                                                         
    |   3 |    VIEW                                 |                                | 25738 |   326K|       |   629K (85)| 02:05:51 |                                                                                                                                                                         
    |*  4 |     SORT GROUP BY STOPKEY               |                                | 25738 |   955K|  6929M|   629K  (2)| 02:05:51 |                                                                                                                                                                         
    |   5 |      CONCATENATION                      |                                |       |       |       |            |          |                                                                                                                                                                         
    |   6 |       MERGE JOIN CARTESIAN              |                                |   150M|  5463M|       | 96245   (2)| 00:19:15 |                                                                                                                                                                         
    |   7 |        TABLE ACCESS BY INDEX ROWID      | EVENTS                         |  1132 | 32828 |       |  1618   (1)| 00:00:20 |                                                                                                                                                                         
    |   8 |         BITMAP CONVERSION TO ROWIDS     |                                |       |       |       |            |          |                                                                                                                                                                         
    |   9 |          BITMAP AND                     |                                |       |       |       |            |          |                                                                                                                                                                         
    |  10 |           BITMAP CONVERSION FROM ROWIDS |                                |       |       |       |            |          |                                                                                                                                                                         
    |  11 |            SORT ORDER BY                |                                |       |       |       |            |          |                                                                                                                                                                         
    |* 12 |             INDEX RANGE SCAN            | EVT_PRIORITY_GMT_DATE_ID_INDEX | 30402 |       |       |    68   (0)| 00:00:01 |                                                                                                                                                                         
    |  13 |           BITMAP CONVERSION FROM ROWIDS |                                |       |       |       |            |          |                                                                                                                                                                         
    |* 14 |            INDEX RANGE SCAN             | EVENT_CODE_INDEX               | 30402 |       |       |    79   (0)| 00:00:01 |                                                                                                                                                                         
    |  15 |           BITMAP CONVERSION FROM ROWIDS |                                |       |       |       |            |          |                                                                                                                                                                         
    |* 16 |            INDEX RANGE SCAN             | FX_EVENT_INDEX                 | 30402 |       |       |   102   (1)| 00:00:02 |                                                                                                                                                                         
    |  17 |           BITMAP CONVERSION FROM ROWIDS |                                |       |       |       |            |          |                                                                                                                                                                         
    |* 18 |            INDEX RANGE SCAN             | IS_GTINDEX_INDEX               | 30402 |       |       |   102   (1)| 00:00:02 |                                                                                                                                                                         
    |  19 |        BUFFER SORT                      |                                |   133K|  1170K|       | 94627   (2)| 00:18:56 |                                                                                                                                                                         
    |  20 |         TABLE ACCESS FULL               | EVENT_KEYWORD_MAPPING          |   133K|  1170K|       |    84   (3)| 00:00:02 |                                                                                                                                                                         
    |* 21 |       HASH JOIN                         |                                |  6691 |   248K|       |  2489   (1)| 00:00:30 |                                                                                                                                                                         
    |* 22 |        TABLE ACCESS BY INDEX ROWID      | EVENTS                         |  1937 | 56173 |       |  2401   (1)| 00:00:29 |                                                                                                                                                                         
    |  23 |         BITMAP CONVERSION TO ROWIDS     |                                |       |       |       |            |          |                                                                                                                                                                         
    |  24 |          BITMAP AND                     |                                |       |       |       |            |          |                                                                                                                                                                         
    |  25 |           BITMAP OR                     |                                |       |       |       |            |          |                                                                                                                                                                         
    |  26 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 27 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  28 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 29 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  30 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 31 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  32 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 33 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  34 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 35 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  36 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 37 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  38 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 39 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  40 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 41 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  42 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 43 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  44 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 45 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  46 |            BITMAP CONVERSION FROM ROWIDS|                                |       |       |       |            |          |                                                                                                                                                                         
    |* 47 |             INDEX RANGE SCAN            | COUNTRY_DISPLAY_INDEX          | 30402 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                         
    |  48 |           BITMAP CONVERSION FROM ROWIDS |                                |       |       |       |            |          |                                                                                                                                                                         
    |* 49 |            INDEX RANGE SCAN             | EVENT_CODE_INDEX               | 30402 |       |       |    79   (0)| 00:00:01 |                                                                                                                                                                         
    |  50 |           BITMAP CONVERSION FROM ROWIDS |                                |       |       |       |            |          |                                                                                                                                                                         
    |* 51 |            INDEX RANGE SCAN             | IS_SCALL_INDEX                 | 30402 |       |       |   100   (1)| 00:00:02 |                                                                                                                                                                         
    |* 52 |        TABLE ACCESS FULL                | EVENT_KEYWORD_MAPPING          | 88609 |   778K|       |    87   (4)| 00:00:02 |                                                                                                                                                                         
    Predicate Information (identified by operation id):                                                                                                                                                                                                                                                        
       2 - filter(ROWNUM<=41)                                                                                                                                                                                                                                                                                  
       4 - filter(ROWNUM<=41)                                                                                                                                                                                                                                                                                  
      12 - access("EVENT_GMT_DATE">=TO_DATE(' 2011-12-27 05:14:00', 'syyyy-mm-dd hh24:mi:ss') AND "EVENT_GMT_DATE"<=TO_DATE('                                                                                                                                                                                  
                  2012-03-27 10:28:44', 'syyyy-mm-dd hh24:mi:ss'))                                                                                                                                                                                                                                             
           filter("EVENT_GMT_DATE"<=TO_DATE(' 2012-03-27 10:28:44', 'syyyy-mm-dd hh24:mi:ss') AND "EVENT_GMT_DATE">=TO_DATE('                                                                                                                                                                                  
                  2011-12-27 05:14:00', 'syyyy-mm-dd hh24:mi:ss'))                                                                                                                                                                                                                                             
      14 - access("EVENT_CODE"='ICC')                                                                                                                                                                                                                                                                          
      16 - access("FX_EVENT"='N')                                                                                                                                                                                                                                                                              
      18 - access("IS_GTINDEX"='Y')                                                                                                                                                                                                                                                                            
      21 - access("THIS_"."EVENT_ID"="EKP"."EVENT_ID")                                                                                                                                                                                                                                                         
      22 - filter(LNNVL("EVENT_CODE"='ICC') OR LNNVL("IS_GTINDEX"='Y') OR LNNVL("FX_EVENT"='N') OR                                                                                                                                                                                                             
                  LNNVL("EVENT_GMT_DATE">=TO_DATE(' 2011-12-27 05:14:00', 'syyyy-mm-dd hh24:mi:ss')) OR LNNVL("EVENT_GMT_DATE"<=TO_DATE('                                                                                                                                                                      
                  2012-03-27 10:28:44', 'syyyy-mm-dd hh24:mi:ss')))                                                                                                                                                                                                                                            
      27 - access("COUNTRY_DISPLAY"='AU')                                                                                                                                                                                                                                                                      
      29 - access("COUNTRY_DISPLAY"='BE')                                                                                                                                                                                                                                                                      
      31 - access("COUNTRY_DISPLAY"='CA')                                                                                                                                                                                                                                                                      
      33 - access("COUNTRY_DISPLAY"='CH')                                                                                                                                                                                                                                                                      
      35 - access("COUNTRY_DISPLAY"='DE')                                                                                                                                                                                                                                                                      
      37 - access("COUNTRY_DISPLAY"='EU')                                                                                                                                                                                                                                                                      
      39 - access("COUNTRY_DISPLAY"='FR')                                                                                                                                                                                                                                                                      
      41 - access("COUNTRY_DISPLAY"='IT')                                                                                                                                                                                                                                                                      
      43 - access("COUNTRY_DISPLAY"='JP')                                                                                                                                                                                                                                                                      
      45 - access("COUNTRY_DISPLAY"='UK')                                                                                                                                                                                                                                                                      
      47 - access("COUNTRY_DISPLAY"='US')                                                                                                                                                                                                                                                                      
      49 - access("EVENT_CODE"='IEP')                                                                                                                                                                                                                                                                          
      51 - access("IS_SCALL"='Y')                                                                                                                                                                                                                                                                              
      52 - filter("EKP"."KEYWORD_ID"=24 OR "EKP"."KEYWORD_ID"=401 OR "EKP"."KEYWORD_ID"=1090 OR "EKP"."KEYWORD_ID"=1643 OR                                                                                                                                                                                     
                  "EKP"."KEYWORD_ID"=2278 OR "EKP"."KEYWORD_ID"=2422)                                                                                                                                                                                                                                           When the above query is executed its taking around 10 seconds to return the data.
    I am using- Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit
    I need help in bringing down the query execution time.
    Thanks,
    Girish G

    A few questions:
    1. Are any indexes available on the Event_KeyWord_Mapping table?
    2. What does '1.4 L records' mean? Not familiar with 'L'.
    3. Are the statistics up to date for the tables and indexes involved?
    4. Are EVENT_ID and KEYWORD_ID the only columns accessed from the Event_KeyWord_Mapping table?
    Assuming the above then DarkStargate's suggestion is on point.
    But you should add the KEYWORD_ID column to the index as well since that is what the index records are filtered on.
    AND  ekp.keyword_id IN (
                            1643,2278,24,1090,2422,401 )Be sure that index statistics are collected; they will provide Oracle with data about the distribution of KEYWORD_ID values.
    This will allow Oracle to get the required information from the index without accessing the Event_KeyWord_Mapping table itself.

  • Need help in query to have all items in sap with PO data on order, date

    Hello Everyone,
    I need some help in writing a query to show all items in sap db to have itemcode, itemname, onhand, sellable(onhand-committed), on order, and the delivery date when that time should be received.  I need to know what items are regular items, which ones are master and components.  For the master I need to have the deliver date of the PO for the component.
    I have written this.
    SELECT DISTINCT TOP (100) PERCENT T1.ItemCode, SUM(T1.Sellable) AS Sellable, T1.OnOrder, MAX(T1.Docduedate) AS DeliveryDate, T1.WhsCode
    FROM         (SELECT     ItemCode, Sellable, OnOrder, '1/1/1900' AS Docduedate, WhsCode
                           FROM          dbo.V_RAZ_StoreInv
                           UNION ALL
                           SELECT     TOP (100) PERCENT ItemCode, '0' AS Sellable, Quantity AS Onorder, DocDueDate, WhsCode
                           FROM         dbo.V_RAZ_OPENPOSDATA
                           ORDER BY ItemCode) AS T1 LEFT OUTER JOIN
                          dbo.V_RAZ_ItemInfo ON T1.ItemCode = dbo.V_RAZ_ItemInfo.ItemCode
    GROUP BY T1.ItemCode, T1.OnOrder, T1.WhsCode, dbo.V_RAZ_ItemInfo.OnHold
    HAVING      (dbo.V_RAZ_ItemInfo.OnHold = 'n')
    ORDER BY T1.ItemCode, T1.WhsCode
    and for the v_raz_openposdata I have the following query
    SELECT     dbo.OPOR.DocNum, dbo.OPOR.DocStatus, dbo.POR1.WhsCode, dbo.POR1.ItemCode, dbo.POR1.Dscription, dbo.POR1.Quantity, dbo.POR1.OpenQty,
                          dbo.POR1.LineStatus, dbo.OPOR.DocDueDate
    FROM         dbo.OPOR LEFT OUTER JOIN
                          dbo.POR1 ON dbo.OPOR.DocEntry = dbo.POR1.DocEntry
    WHERE     (dbo.OPOR.DocStatus = 'O')
    Any help is greatly appreciated. 
    Right now I do get the delivery date for regular items and components but the master sku for the component all of them have 1/1/1900. 
    Thank you

    Thank you for replying Gordon.  I did not remember I had asked this before.  I no longer have access to the other account. 
    What I need on the query is that I want  a list of items with the on order quantity and when we are expecting this order to be received.  The receiving date is based on the PO delivery date.  The trick here is that  I need to Master sku to show the delivery date of the component sku.  In my scenario all components have the same delivery date for the Master sku.  If there are mulitple delivery dates because each warehouse is getting them on a different date then I want to get the delivery date for that warehouse.
    Let me know if this is possible and if yes please guide towards a query for it.
    Thank you.

  • Need help on query simplification...!!

    Hi All,
    I need help on below query simplification using idempotence rules.
    SELECT ENO FROM AGS WHERE RESP = "Analyst" AND NOT (PNO = "P2" OR DUR = 12) AND PNO != "P2" AND DUR = 12;
    Thanks.

    928351 wrote:
    Hi All,
    I need help on below query simplification using idempotence rules.
    SELECT ENO FROM AGS WHERE RESP = "Analyst" AND NOT (PNO = "P2" OR DUR = 12) AND PNO != "P2" AND DUR = 12;
    Thanks.How do we know what the correct result set is?
    Handle:     928351
    Status Level:     Newbie
    Registered:     Apr 17, 2012
    Total Posts:     4
    Total Questions:     3 (3 unresolved)
    ZERO for three! STRIKE 3 you are out!

  • Need help in query to display lot and serial numbers for a Wip Job Component

    Hi ALL,
    I have a requirement as below.
    I need to display lot and serial numbers for a Wip Job Component, i have a xml report in that for each wip job component i need to check whether it is a lot control item or serial control item based on that i need to display some data. so can you please help me to get the query to indentify the lot and serial number for a wip job component.
    Thanks

    Thank you for replying Gordon.  I did not remember I had asked this before.  I no longer have access to the other account. 
    What I need on the query is that I want  a list of items with the on order quantity and when we are expecting this order to be received.  The receiving date is based on the PO delivery date.  The trick here is that  I need to Master sku to show the delivery date of the component sku.  In my scenario all components have the same delivery date for the Master sku.  If there are mulitple delivery dates because each warehouse is getting them on a different date then I want to get the delivery date for that warehouse.
    Let me know if this is possible and if yes please guide towards a query for it.
    Thank you.

  • Need help with query joining several tables into a single return line

    what i have:
    tableA:
    puid, task
    id0, task0
    id1, task1
    id2, task2
    tableB:
    puid, seq, state
    id0, 0, foo
    id0, 1, bar
    id0, 2, me
    id1, 0, foo
    id2, 0, foo
    id2, 1, bar
    tableC:
    puid, seq, date
    id0, 0, 12/21
    id0, 1, 12/22
    id0, 2, 12/22
    id1, 0, 12/23
    id2, 0, 12/22
    id2, 1, 12/23
    what i'd like to return:
    id0, task0, 12/21, 12/22, 12/22
    id1, task1, 12/23, N/A, N/A
    id2, task2, 12/22, 12/23, N/A
    N/A doesn't mean return the string "N/A"... it just means there was no value, so we don't need anything in this column (null?)
    i can get output like below through several joins, however i was hoping to condense each "id" into a single line...
    id0, task0, 12/21
    id0, task0, 12/22
    id0, task0, 12/23
    id1, task1, 12/23
    is this possible fairly easily?
    Edited by: user9979830 on Mar 29, 2011 10:53 AM
    Edited by: user9979830 on Mar 29, 2011 10:58 AM

    Hi,
    Welcome to the forum!
    user9979830 wrote:
    what i have:...Thanks for posting that so clearly!
    Whenever you have a question, it's even better if you post CREATE TABLE and INSERT statements for your sample data, like this:
    CREATE TABLE     tablea
    (       puid     VARCHAR2 (5)
    ,     task     VARCHAR2 (5)
    INSERT INTO tablea (puid, task) VALUES ('id0',  'task0');
    INSERT INTO tablea (puid, task) VALUES ('id1',  'task1');
    INSERT INTO tablea (puid, task) VALUES ('id2',  'task2');
    CREATE TABLE     tablec
    (       puid     VARCHAR2 (5)
    ,     seq     NUMBER (3)
    ,     dt     DATE          -- DATE is not a good column name
    INSERT INTO tablec (puid, seq, dt) VALUES ('id0',  0,  DATE '2010-12-21');
    INSERT INTO tablec (puid, seq, dt) VALUES ('id0',  1,  DATE '2010-12-22');
    INSERT INTO tablec (puid, seq, dt) VALUES ('id0',  2,  DATE '2010-12-22');
    INSERT INTO tablec (puid, seq, dt) VALUES ('id1',  0,  DATE '2010-12-23');
    INSERT INTO tablec (puid, seq, dt) VALUES ('id2',  0,  DATE '2010-12-22');
    INSERT INTO tablec (puid, seq, dt) VALUES ('id2',  1,  DATE '2010-12-23');This way, people can re-create the problem and test their ideas.
    It doesn't look like tableb plays any role in this problem, so I didn't post it.
    Explain how you get the results from that data. For example, why do you want this row in the results:
    PUID  TASK  DT1        DT2        DT3
    id0   task0 12/21/2010 12/22/2010 12/22/2010rather than, say
    PUID  TASK  DT1        DT2        DT3
    id0   task0 12/22/2010 12/21/2010 12/22/2010? Does 12/21 have to go in the first column because it is the earliest date, or is it because 12/21 is related to the lowest seq value? Or do you even care about the order, just as long as all 3 dates are shown?
    Always say what version of Oracle you're uisng. The query below will work in Oracle 9 (and up), but starting in Oracle 11, the SELECT ... PIVOT feature could help you.
    i can get output like below through several joins, however i was hoping to condense each "id" into a single line... Condensing the output, so that there's only one line for each puid, sounds like a job for "GROUP BY puid":
    WITH     got_r_num     AS
         SELECT     puid
         ,     dt
         ,     ROW_NUMBER () OVER ( PARTITION BY  puid
                                   ORDER BY          seq          -- and/or dt
                           )         AS r_num
         FROM    tablec
    --     WHERE     ...     -- If you need any filtering, put it here
    SELECT       a.puid
    ,       a.task
    ,       MIN (CASE WHEN r.r_num = 1 THEN r.dt END)     AS dt1
    ,       MIN (CASE WHEN r.r_num = 2 THEN r.dt END)     AS dt2
    ,       MIN (CASE WHEN r.r_num = 3 THEN r.dt END)     AS dt3
    ,       MIN (CASE WHEN r.r_num = 4 THEN r.dt END)     AS dt4
    FROM       tablea    a
    JOIN       got_r_num r  ON   a.puid  = r.puid
    GROUP BY  a.puid
    ,            a.task
    ORDER BY  a.puid
    ;I'm guessing that you want the dates arranged by seq; that is, for each puid, the date related to the lowest seq comes first, regardless of whther that date is the earliest date for that puid or not. If that's not what you need, then change the analytic ORDER BY clause.
    This does not assume that the seq values are always consecutive integers (0, 1, 2, ...) for each puid. You can skip, or even duplicate values. However, if the values are always consecutive integers, starting from 0, then you could simplify this. You won't need a sub-query at all; just use seq instead of r_num in the main query.
    Here's the output I got from the query above:
    PUID  TASK  DT1        DT2        DT3        DT4
    id0   task0 12/21/2010 12/22/2010 12/22/2010
    id1   task1 12/23/2010
    id2   task2 12/22/2010 12/23/2010As posted, the query will display the first 4 dts for each puid.
    If there are fewer than 4 dts for a puid, the query will still work. It will leave some columns NULL at the end.
    If there are more than 4 dts for a puid, the query will still work. It will display the first 4, and ignore the others.
    There's nothing special about the number 4; you could make it 3, or 5, or 35, but whatever number you choose, you have to hard-code that many columns into the query, and always get that many columns of output.
    For various ways to deal with a variable number of pivoted coolumns, see the following thread:
    PL/SQL
    This question actually doesn't have anything to do with SQL*Plus; it's strictly a SQL question, and SQL questions are best posted on the "SQL and PL/SQL" forum:
    PL/SQL
    If you're not sure whether a question is more of a SQL question or a SQL*Plus question, then post it on the SQL forum. Many more people pay attention to that forum than to this one.

  • Need Help in BSP-Urgent

    Hi All,
    I am new in BSP and having some issues,need help from someone it is very urgent for me.
    1) How to create a F4 help/LOOKUP TABLE?
    Having one parameter like COMPANY NAME with search button.If i click on search button it should populate all the company information like company name,city and country into lookup table with filter option.If i select particular row from lookup table then company name should pass into parameter.
    2)Having 6 parameter's like Employe ID,name,email-id,phone,city and country.My requirement is if i enter employe ID and press enter then other detail should populate into corresponding parameter?
    If possible send me the code in ABAP.
    Appreciate your help.
    Thanks in Advance.
    Regards,
    Vicky

    Welcome to SDN
    You are aksing us to write the complete application for you. This is not the place for that. If you have some specific issues/clarification we are all more than happy to help you. For the kind of questions you had asked, you should first learn BSP by going through various resources here in SDN and in help.sap.com
    Regards
    Raja
    PS: avoid using urgent in your subject line.

  • Hi need help..very urgent..

    Hi ABAPers,
    I am very new to ABAP..i need help in coding this following logic,,,
    Can anyone help me in coding this following logic..
    Step 1.  Retrieve customer number KUNNR from VBAK
    Step 2.  Pass customer number KUNNR to KNA1 and retrieve address number-ADANR value
    Step 3.  Pass ADANR value to ADRC table to retrieve NAME3
    Please do reply guys..
    full marks would be given for the right answer.
    Regards
    Sahil

    If Windows Live Mail can export the mailboxes in .mbox format then they can be imported into Mail. Otherwise, you would need to export the accounts to Thunderbird, Netscape, or Office Entourage in order to directly import into Mail.

Maybe you are looking for

  • Project online integration

    has anyone done the project online integration with microsoft dynamics (nav, gp, ax)? would odata interface be good for integration? any experience to share?  thanks, Jeff

  • Nested AM for Imported Bounded Task Flows - jdev 11.1.2.3 redhat 5.8

    Hello: Examples below all are Fusion ADF Web Apps. subsystem1 = ss1 creates adflib1 with bounded task flow = tf1 subsystem2 = ss2 creates adflib2 with bounded task flow = tf2 Master system imports adflib1 and adflib2 In Master how can I create a app

  • How to use the External Jars

    Hi All, I want to use the Api for java advanced imaging, and i don't know where to place that jar and how to use the classes from that to do the related programming. Please help. Thanks Mahesh.

  • Time machine makes too many full back-ups

    Yes, this has been written about ad nauseam almost since Time Machine's been around. But I am really tired of going through 3 and 4 TB hard drives because of a Time Machine bug/error/glitch/what-have-you. The latest message (from the Time Machine Bud

  • Workflow Manager disaster recovery old instances not moving forward

    Dear ALL, I am facing an issue in workflow manager 1.0 disaster recovery. I followed all the steps to recover workflow manager 1.0 mentioned in MSDN, new instances which I have created after restoration working fine, but the old workflow instances wh