Trouble with a simple Query

Hello, I'll start by saying that I am a noob. Anyways, I am trying to do what I thought would be a simple query to get records that are greater than or equal to the current date: this is my query...
<cfquery name="getUpcoming" datasource="events">
SELECT title, eventDate FROM event WHERE eventDate >= #Now()# ORDER BY eventDate ASC
</cfquery>
It works, sort of, I do get records that are greater than the current date, but any records that are equal to do not show up.
I am assuming that it is looking at time as well, or I am doing it completely wrong. I don't know? Any help would be greatly appreciated.

I didn't use the cfqueryparam as suggested, is there something dangerous about doing it this way?
Nothing dangerous, no.  Just "less than ideal" (in a sloppy / lazy sort of way).  As I suggested, one should not hard-code dynamic values into the SQL string, one should pass them as parameters.  it's just "the way it should be done".
When the DB receives your SQL string (with the dynamic values hard-coded), the DB engine needs to compile the SQL to make an execution plan before executing the query.  Any change to the SQL string requires recompilation.  However if you pass your parameter as parameters, then the SQL does not need to be recompiled.
It's the same sort of thing as not using global variables unless one has to, despite the fact they're "easier", or duplicating code instead of refactoring code.  One should try to write decent code.
Adam

Similar Messages

  • Help with a simple query

    Hi ,
    I'm running the following simple query in sql*plus on ORACLE9i. But this query stopped running after 30minutes, and the sql*plus die at the same time .I have no idea about this. Could somebody tell me how I can solve this problem. Thank you very much for your help.
    Select Distinct PERSADDRUSE. ADDRUSECD as "Application", PERS.PERSNBR as "Account",
    (PERS.FIRSTNAME || ' '|| PERS.MDLINIT ||' ' || PERS.LASTNAME ) as "Name1",' 'as "Name2",' 'as "Name3",
    AL1.TEXT as "Address1",AL2.TEXT as "Address2",AL3.TEXT as "Address3",
    (ADDR.CITYNAME ||' ' || ' '||ADDR.STATECD ||' '||ADDR.ZIPCD||' '|| ADDR.ZIPSUF) as "CityStateZip"
    From PERSADDRUSE
    Join PERS
    ON PERS.PERSNBR = PERSADDRUSE.PERSNBR
    --AND  PERS.ADDDATE = '12-JAN-2005'
    AND PERSADDRUSE.ADDRUSECD = 'PRI'
    join ADDR
    ON PERSADDRUSE.ADDRNBR = ADDR.ADDRNBR
    left JOIN ADDRLINE AL1
    ON ADDR.ADDRNBR = AL1.ADDRNBR
    AND AL1.LINENBR = 1
    left JOIN ADDRLINE AL2
    ON ADDR.ADDRNBR = AL2.ADDRNBR
    AND AL2.LINENBR = 2
    left JOIN ADDRLINE AL3
    ON ADDR.ADDRNBR = AL3.ADDRNBR
    AND AL3.LINENBR = 3;

    Thanks for reply. I have some other query running for 45m and it seems fine. The following are the explain plan I print out. I'm new to PL/SQL.Could you guys give me some other ideas?
    BMS_XPLAN.DISPLAY()(PLAN_TABLE_OUTPUT)
    PERSADDRUSE | 5726 | 68712 | 183 |'), DBMS_XPLAN_TYPE('| 8 | TABLE ACCESS FULL| PERS | 161K| 2839K| 431 |'), DBMS_XPLAN_TYPE('| 9 | TABLE ACCESS FULL | ADDR | 239K| 5145K| 298 |'), DBMS_XPLAN_TYPE('| 10 | TABLE ACCESS FULL | ADDRLINE | 82087 | 1683K| 240 |'), DBMS_XPLAN_TYPE('| 11 | TABLE ACCESS FULL | ADDRLINE | 82087 | 1683K| 240 |'), DBMS_XPLAN_TYPE('| 12 | TABLE ACCESS FULL | ADDRLINE | 82087 | 1683K| 240 |'), DBMS_XPLAN_TYPE('------------------------------------------------------------------------'), DBMS_XPLAN_TYPE(' '), DBMS_XPLAN_TYPE('Note: cpu costing is off, PLAN_TABLE'' is old version'))

  • Trouble with a simple transition

    I'm new to actionscript and trying to wrap my head around some simple scripting, but am having trouble.
    My goal in this excercise is to have one symbol/movie clip in frame 1 (stopped on that frame) and then, when clicked, the first cube will dissapear and transition to a different symbol/movie clip in frame 2.
    Here is my script:
    stop();
    stationary1.addEventListener(MouseEvent.CLICK, transition);
    function transition(evt:MouseEvent):void {
        evt.currentTarget.gotoAndStop(2);
        evt.currentTarget.mouseEnabled = false;
    The movie clips I'm working with are just revolving cubes that are different colors. What happens when I run this script is the initial cube is there spinning as intended in frame 1, then when I click it the initial cube freezes and the other cube doesn't show up.

    you probably don't want the evt.currentTarget to advance to frame 2.  that would be the 2nd frame on stationary1's timeline.
    try:
    stop();
    stationary1.addEventListener(MouseEvent.CLICK, transition);
    function transition(evt:MouseEvent):void {
    gotoAndStop(2);

  • What is wrong with this simple query

    Hi,
    I am writting a simple code just to get the maximum no values from a database table
    The query is
    ResultSet = stm.executeQuery("SELECT MAX(column_name) FROM Database_table ");
    it seems to be a simple one but i am getting the message
    column not found
    Please answer soon

    Well, it depends on how your resultset is retrieving the results. If you retrieve by column name, then that's your problem. You need to do something like this:
    ResultSet = stm.executeQuery("SELECT MAX(column_name) AS myColumnName FROM Database_table ");
    String myResult = ResultSet.getString(myColumnName);Using MAX, COUNT, etc, will return your result with a mangled or no actual column name to retrieve from. Optionally, you can solve your problem by:
    ResultSet.getString(1);Michael Bishop

  • I'm having Trouble with a Simple Histogram

    The program as a whole is supposed to read a text file, count the number of words, and ouput it. For example, "The The The pineapple pineapple" should ouput "The 3, Pineapple 2" I've gotten as far as dumping the tokens into an array and creating 2 empty arrays of the same size(word, count), but I don't know how to do the double loop that's necessory for the count. Please see my "hist()" method, this is where I'm having trouble. Any suggestions at all would be greatly appreciated. import java.io.*;
    import java.util.*;
    /*class Entry {
        String word;
        int count;
    class main { 
        public static void main(String[] args){
         main h = new main();
         h.menu();
        String [] wrd;
        String [] words;
        int[] count;
        int wordcount = 0;
        int foundit = -1;
        int size;
        int numword = 0;
        int i = 0;
        int j = 0;
        int elements = 0;
        public void menu() {
          System.out.println("Welcome to Histogram 1.0");
          BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
          while(true){
              System.out.println("Please enter one of the following commands: open, hist, show, save, help, or quit");
              String s = null;
              try {s = in.readLine();} catch (IOException e) {}
              if (s.equals("open")) open();
              else if (s.equals("hist")) hist();
              else if (s.equals("show")) show();
              else if (s.equals("save")) save();
              else if (s.equals("help")) help();
              else if (s.equals("quit")) {
                  System.exit(0);
         public void open(){
         // prompt user for name of file and open it
         System.out.println("Enter Name Of File: ");
         BufferedReader in = new BufferedReader(new InputStreamReader (System.in));
         String filename = null;
         try{ filename = in.readLine();}
         catch(IOException e)  {}
         BufferedReader fin = null;
         try { fin = new BufferedReader (new FileReader(filename));}
         catch (FileNotFoundException e){
             System.out.println("Can't open file "+filename+" for reading, please try again.");
             return;
         // read file for 1st time to count the tokens
         String line = null;
         try{ line = fin.readLine();}
         catch(IOException e) {}
         StringTokenizer tk = new StringTokenizer(line);
         while(line!= null){
             try{ line = fin.readLine();}
             catch(IOException e) {}
             //tk = new StringTokenizer(line);
             wordcount += tk.countTokens();
             System.out.println("wordcount = " + wordcount);
         // close file
         try{fin.close();}
         catch(IOException e){
             System.out.println( filename+" close failed");
         // now go through file a second time and copy tokens into the new array
         wrd = new String [wordcount];
            BufferedReader fin2 = null;
            try{ fin2 = new BufferedReader (new FileReader(filename));}
            catch(FileNotFoundException e){
                System.out.println("Can't open file "+filename+" for reading, please try again.");
                return;
            String pop = null;
            try{ pop = fin2.readLine();}
            catch(IOException e) {}
            StringTokenizer tk2 = new StringTokenizer(pop);
         int nextindex = 0;
         while(pop!=null){
             while (tk2.hasMoreTokens()) {
              wrd[nextindex] = tk2.nextToken();
              nextindex++;
             try{ pop = fin2.readLine();}
             catch(IOException e) {}
             //tk2 = new StringTokenizer(pop);
         try{fin2.close();}
         catch(IOException e){
             System.out.println(filename+" close failed");
         for(int k=0;  k<wordcount; k++){
            System.out.println(wrd[k]);
        public void hist() {
            //prints out all the tokens
           words = new String[wordcount];
           count = new int[wordcount];
           //boolean test = false;
               for(int m=0; m<wordcount; m++){
                   if(words.equals(wrd[m])){
                       System.out.print("match");        
                   else{
                       words[m] = wrd[m];
                       count[m] = 1;
        public void show() {
         //shows all the tokens
         for(int j=0; j<wordcount; j++){
              System.out.print(words[j]);
              System.out.print(count[j]);
        public void save() {
            //Write the contents of the entire current histogram to a text file
            PrintWriter out = null;
            try { out = new PrintWriter(new FileWriter("outfile.txt"));}
            catch(IOException e) {}
            for (int i= 0; i<wordcount; i++) {
                out.println(words);
    out.println(count[i]);
    out.close();
    public void help() {
    System.out.println(" This help will tell you what each command will do.");
    System.out.println("");
    System.out.println(" open - this command will open a text file that must be in the same directory ");
    System.out.println(" as the program and scan through it counting how many words it has, ");
    System.out.println("");
    System.out.println(" hist - after you use the open command to open the text file the hist command will ");
    System.out.println(" make a tally sheet counting how many times each word has been used. ");
    System.out.println("");
    System.out.println(" show - after you have opened the file with the open command and created a histogram ");
    System.out.println(" with the hist command the show command will show a portion of or the entire h histogram. ");
    System.out.println("");
    System.out.println(" (show) just by itself will show the entire histogram. ");
    System.out.println("");
    System.out.println(" (show abc) will show the histogram count for the text abc if it exists. ");
    System.out.println(" If the text is not found it will display text not found. ");
    System.out.println("");
    System.out.println(" (show pr*) will show the histogram count for all text items that begin with ");
    System.out.println(" the letters pr, using * as a wild card character. ");
    System.out.println("");
    System.out.println(" save - after you have opened the file with the open command, and created the histogram ");
    System.out.println(" with the hist command the save command will save the contents of the entire current histogram. ");
    System.out.println(" to a text file that you choose the name of. If the file already exists the user will be prompted ");
    System.out.println(" for confirmation on if they want to pick another name or overwrite the file.");
    System.out.println("");
    System.out.println(" quit - will quit the program. " );

    Couple of points to begin with:
    1. Class names should begin with an upper case letter
    2. Class names should be descriptive
    3. You shouldn't call your class main (this kind of follows from the first two points).
    4. Always use {} around blocks of code, it will make your life, and those of the people who have to eventually maintain your code a lot easier.
    5. Never ignore exceptions, i.e. don't use an empty block to catch exceptions.
    6. Avoid assiging a local variable to null, especially if the only reason you are doing it is to "fix" a compilation error.
    7. Your method names should reflect everything that the method does, this should encourage you to break the application logic down into the smallest tasks possible (a general rule is that each method should do one task, and do it well). In the example below, I ignore this advice in the loadFile() method, but it's left as an exercise to you to fix this.
    8. You should use descriptive variable names (fin may make sense now, but will it in 6 months time?), and use camel case where the name uses multiple words, e.g. wordcount should be wordCount
    On the problem at hand, I'll post a cut down example of what you want, and you can look at the javadocs, and find out how it works.
    This code uses the auto-boxing feature of 1.5 (even though I don't like it, again it's left as an exercise for you to remove the auto-boxing ;) ) and some generics (you should be able to work out how to use this code in 1.4).
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.util.HashMap;
    import java.util.Map;
    import java.util.StringTokenizer;
    public class Histogram {
        /** Map to box the words. */
        private Map<String, Integer> wordMap = new HashMap<String, Integer>();
         * Main method.
         * @param args
         *        Array of command line arguments
        public static void main(String[] args) {
            Histogram h = new Histogram();
            h.menu();
         * Display the menu, and enter program loop.
        public void menu() {
            System.out.println("Welcome to Histogram 1.0");
            BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
            while (true) {
                System.out.println("Please enter one of the following commands: open, hist, show, save, help, or quit");
                String s = null;
                try {
                    s = in.readLine();
                } catch (IOException e) {
                    System.out.println("Unable to interpret the input.");
                    continue;
                if (s.equals("open")) {
                    loadFile();
                } else if (s.equals("quit")) {
                    System.exit(0);
         * Ask the user for a file name and load it
        public void loadFile() {
            System.out.println("Enter Name Of File: ");
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String filename = null;
            try {
                filename = reader.readLine();
                reader = new BufferedReader(new FileReader(filename));
                loadWords(reader);
                reader.close();
            } catch (FileNotFoundException e) {
                System.out.println("Can't open file " + filename + " for reading, please try again.");
                return;
            } catch (IOException e) {
                System.out.println(filename + " close failed");
            displayHistogram();
         * Load the words from the file into the map.
         * @param reader
        private void loadWords(BufferedReader reader) {
            int wordCount = 0;
            try {
                String line = reader.readLine();
                while (line != null) {
                    StringTokenizer tk = new StringTokenizer(line);
                    wordCount += tk.countTokens();
                    while (tk.hasMoreTokens()) {
                        String next = tk.nextToken();
                        if (wordMap.containsKey(next)) {
                            wordMap.put(next, (wordMap.get(next).intValue() + 1));
                        } else {
                            wordMap.put(next, 1);
                    System.out.println("line: " + line + " word count = " + wordCount);
                    line = reader.readLine();
            } catch (IOException e) {
                System.out.println("Unable to read next line");
         * Display the words and their count.
        private void displayHistogram() {
            System.out.println("Map of words: " + wordMap);
    }

  • Performance problem with relatively simple query

    Hi, I've a statement that takes over 20s. It should take 3s or less. The statistics are up te date so I created an explain plan and tkprof. However, I don't see the problem. Maybe somebody can help me with this?
    explain plan
    SQL Statement which produced this data:
      select * from table(dbms_xplan.display)
    PLAN_TABLE_OUTPUT
    | Id  | Operation               |  Name              | Rows  | Bytes |TempSpc| Cost  |
    |   0 | SELECT STATEMENT        |                    | 16718 |   669K|       | 22254 |
    |   1 |  SORT UNIQUE            |                    | 16718 |   669K|    26M| 22254 |
    |   2 |   FILTER                |                    |       |       |       |       |
    |*  3 |    HASH JOIN            |                    |   507K|    19M|       |  9139 |
    |   4 |     TABLE ACCESS FULL   | PLATE              | 16718 |   212K|       |    19 |
    |*  5 |     HASH JOIN           |                    |   507K|    13M|  6760K|  8683 |
    |*  6 |      HASH JOIN          |                    |   216K|  4223K|       |  1873 |
    |*  7 |       TABLE ACCESS FULL | SDG_USER           |  1007 |  6042 |       |     5 |
    |*  8 |       HASH JOIN         |                    |   844K|    11M|       |  1840 |
    |*  9 |        TABLE ACCESS FULL| SDG                |  3931 | 23586 |       |     8 |
    |  10 |        TABLE ACCESS FULL| SAMPLE             |   864K|  6757K|       |  1767 |
    |* 11 |      TABLE ACCESS FULL  | ALIQUOT            |  2031K|    15M|       |  5645 |
    |  12 |    INDEX UNIQUE SCAN    | PK_OPERATOR_GROUP  |     1 |     5 |       |       |
    |  13 |    INDEX UNIQUE SCAN    | PK_OPERATOR_GROUP  |     1 |     5 |       |       |
    |  14 |    INDEX UNIQUE SCAN    | PK_OPERATOR_GROUP  |     1 |     5 |       |       |
    |  15 |    INDEX UNIQUE SCAN    | PK_OPERATOR_GROUP  |     1 |     5 |       |       |
    Predicate Information (identified by operation id):
       3 - access("SYS_ALIAS_2"."PLATE_ID"="SYS_ALIAS_1"."PLATE_ID")
       5 - access("SYS_ALIAS_3"."SAMPLE_ID"="SYS_ALIAS_2"."SAMPLE_ID")
       6 - access("SYS_ALIAS_4"."SDG_ID"="SDG_USER"."SDG_ID")
       7 - filter("SDG_USER"."U_CLIENT_TYPE"='QC')
       8 - access("SYS_ALIAS_4"."SDG_ID"="SYS_ALIAS_3"."SDG_ID")
       9 - filter("SYS_ALIAS_4"."STATUS"='C' OR "SYS_ALIAS_4"."STATUS"='P' OR "SYS_ALIA
                  S_4"."STATUS"='V')
      11 - filter("SYS_ALIAS_2"."PLATE_ID" IS NOT NULL)
    Note: cpu costing is off
    tkprof
    TKPROF: Release 9.2.0.1.0 - Production on Mon Sep 22 11:09:37 2008
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Trace file: d:\oracle\admin\nautp\udump\nautp_ora_5708.trc
    Sort options: default
    count    = number of times OCI procedure was executed
    cpu      = cpu time in seconds executing
    elapsed  = elapsed time in seconds executing
    disk     = number of physical reads of buffers from disk
    query    = number of buffers gotten for consistent read
    current  = number of buffers gotten in current mode (usually for update)
    rows     = number of rows processed by the fetch or execute call
    alter session set sql_trace true
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        1      0.00       0.00          0          0          0           0
    Misses in library cache during parse: 0
    Misses in library cache during execute: 1
    Optimizer goal: CHOOSE
    Parsing user id: 61 
    SELECT distinct p.name
    FROM lims_sys.sdg sd, lims_sys.sdg_user sdu, lims_sys.sample sa, lims_sys.aliquot a, lims_sys.plate p
    WHERE sd.sdg_id = sdu.sdg_id
    AND sd.sdg_id = sa.sdg_id
    AND sa.sample_id = a.sample_id
    AND a.plate_id = p.plate_id
    AND sd.status IN ('V','P','C')
    AND sdu.u_client_type = 'QC'
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.09       0.09          0          3          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        1      7.67      24.63      66191      78732          0         500
    total        3      7.76      24.72      66191      78735          0         500
    Misses in library cache during parse: 1
    Optimizer goal: CHOOSE
    Parsing user id: 61 
    Rows     Row Source Operation
        500  SORT UNIQUE
    520358   FILTER 
    520358    HASH JOIN 
      16757     TABLE ACCESS FULL PLATE
    520358     HASH JOIN 
    196632      HASH JOIN 
       2402       TABLE ACCESS FULL SDG_USER
    834055       HASH JOIN 
       3931        TABLE ACCESS FULL SDG
    864985        TABLE ACCESS FULL SAMPLE
    2037373      TABLE ACCESS FULL ALIQUOT
          0    INDEX UNIQUE SCAN PK_OPERATOR_GROUP (object id 33865)
          0    INDEX UNIQUE SCAN PK_OPERATOR_GROUP (object id 33865)
          0    INDEX UNIQUE SCAN PK_OPERATOR_GROUP (object id 33865)
          0    INDEX UNIQUE SCAN PK_OPERATOR_GROUP (object id 33865)
    select 'x'
    from
    dual
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        1      0.00       0.00          0          3          0           1
    total        3      0.00       0.00          0          3          0           1
    Misses in library cache during parse: 1
    Optimizer goal: CHOOSE
    Parsing user id: 61 
    Rows     Row Source Operation
          1  TABLE ACCESS FULL DUAL
    begin :id := sys.dbms_transaction.local_transaction_id; end;
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0         12          0           1
    Fetch        0      0.00       0.00          0          0          0           0
    total        2      0.00       0.00          0         12          0           1
    Misses in library cache during parse: 1
    Optimizer goal: CHOOSE
    Parsing user id: 61 
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        3      0.09       0.09          0          3          0           0
    Execute      4      0.00       0.00          0         12          0           1
    Fetch        2      7.67      24.63      66191      78735          0         501
    total        9      7.76      24.72      66191      78750          0         502
    Misses in library cache during parse: 3
    Misses in library cache during execute: 1
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse       48      0.00       0.00          0          0          0           0
    Execute     54      0.00       0.01          0          0          0           0
    Fetch       65      0.00       0.00          0        157          0          58
    total      167      0.00       0.01          0        157          0          58
    Misses in library cache during parse: 16
        4  user  SQL statements in session.
       48  internal SQL statements in session.
       52  SQL statements in session.
    Trace file: d:\oracle\admin\nautp\udump\nautp_ora_5708.trc
    Trace file compatibility: 9.00.01
    Sort options: default
           1  session in tracefile.
           4  user  SQL statements in trace file.
          48  internal SQL statements in trace file.
          52  SQL statements in trace file.
          20  unique SQL statements in trace file.
         500  lines in trace file.Edited by: RZ on Sep 22, 2008 2:27 AM

    A few notes:
    1. You seem to have either a VPD policy active or you're using views that add some more predicates to the query, according to the plan posted (the access on the PK_OPERATOR_GROUP index). Could this make any difference?
    2. The estimates of the optimizer are really very accurate - actually astonishing - compared to the tkprof output, so the optimizer seems to have a very good picture of the cardinalities and therefore the plan should be reasonable.
    3. Did you gather index statistics as well (using COMPUTE STATISTICS when creating the index or "cascade=>true" option) when gathering the statistics? I assume you're on 9i, not 10g according to the plan and tkprof output.
    4. Looking at the amount of data that needs to be processed it is unlikely that this query takes only 3 seconds, the 20 seconds seems to be OK.
    If you are sure that for a similar amount of underlying data the query took only 3 seconds in the past it would be very useful if you - by any chance - have an execution plan at hand of that "3 seconds" execution.
    One thing that I could imagine is that due to the monthly data growth that you've mentioned one or more of the tables have exceeded the "2% of the buffer cache" threshold and therefore are no longer treated as "small tables" in the buffer cache. This could explain that you now have more physical reads than in the past and therefore the query takes longer to execute than before.
    I think that this query could only be executed in 3 seconds if it is somewhere using a predicate that is more selective and could benefit from an indexed access path.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Wat is wrong with this simple query ???

    I am using 10gxe.
    Below is the query which is not working
    Whenever i am executing it a pop up windows is coming up
    and asking me to enter bind variables ..wat shall i do ???
    Here is a prntscrn of the issue .
    http://potupaul.webs.com/at.html
    VARIABLE g_message VARCHAR2(30)
    BEGIN
    :g_message := 'My PL/SQL Block Works';
    END;
    PRINT g_message
    Edited by: user4501184 on May 18, 2010 12:42 AM

    sqlplus "system/sm@test"
    SQL*Plus: Release 10.2.0.2.0 - Production on Tue May 18 12:45:05 2010
    Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> VARIABLE g_message VARCHAR2(30)
    SQL> BEGIN
    2 :g_message := 'My PL/SQL Block Works';
    3 END;
    4 /
    PL/SQL procedure successfully completed.
    SQL> PRINT g_message;
    G_MESSAGE
    My PL/SQL Block Works
    SQL>

  • Trouble with a SQ01 Query...

    Hi all!! what's up!
    I need to show a new field in a Query, I already include it in my infoset, and in the query visualization, but when I try to execute the Query, it shows all the old fields and don't show my new field... How can I do it??
    Thanks a lot and sorry for my English.

    Ok, let's see...
    At first, I modified the Infoset (SQ02) , including my new field in a Fields Group.
    And Next, I switched on all the boxes in SQ01 of my New Field...
    My field is EINE-NETPR... the EINE Table was on the query before, with other fields too.
    Edited by: Julio Pita de la Vega on Mar 24, 2008 3:14 PM

  • Ora-6000 with a simple query

    Hi,
    I registered three XSD schemas, they were created by "trang" as you can read at:
    XML schema register , tables and types.
    After I corrected namespace and i added following options: storeVarrayAsTable="true", maintainDOM="false" and a defaultTable.
    They were register successfull, and all tables was created either. I insert three little XMl files in the default table. Three rows were created (I try: select count(*))
    Then I try this query:
    Query:
    select extract(object_value,'/') from mitablename;
    but I got this error:
    Error:
    ORA-00600: código de error interno, argumentos: [kokax_oct_adtcbk5], [], [], [], [], [], [], []
    If I try the same query in SQLdeveloper i get this:
    http://img484.imageshack.us/img484/7017/ora00600lu7.jpg
    I'm trying with oracle XE here at home.
    Did anyone know anything about this error ?
    thanks!
    Message was edited by:
    pollopolea

    It is a long shot, but because of "XE", the ORA-0600, and maybe because you don't have a customer support id.; you could re-install XDB. This will invalidate all your schema based structures and repos. stuff (if dependend on the XDB schema). The XDB schema will be dropped be dropped during this excercise...so make a backup if needed !!!
    For *nix OS systems the following could be done to re-install XDB - MAKE A FULL (RMAN) BACKUP of your DATABASE
    conn / as sysdba
    spool /tmp/reinstall.log
    @?/rdbms/admin/catnoqm.sql
    shutdown immediate
    startup
    @?/rdbms/admin/catqm.sql
    spool off
    No "mayor" errors should be notified in the spooled log file. If so re-try once to run catqm.sql
    -- to enable HTTP agian
    call dbms_xdb.setHTTPport(8080)
    -- to enable FTP again
    call dbms_xdb.setFTPport(2100)Message was edited by:
    mgralike

  • Hello oracle gurus ... I have a trouble with the following query ...

    Any help would be appreciated ...
    My oracle database ...
    producttype --|-- creationtime --|-- count
    2 --|-- 4/07 --|-- 5
    2 --|-- 5/07 --|-- 6
    1 --|-- 5/07 --|-- 9
    I need to write a query to populate a dataset. The table I should construct later will have to look like this, sort off ...
    creationtime --|-- 1 (producttype) --|-- 2 (producttype)
    4/07 --|-- 0 --|-- 5
    5/07 --|-- 9 --|-- 6
    The example is self explanatory and I wanted to make it as minimalistic as posible.
    One other problem. When you look at that creationtime column up there. I will have to generate that separatelly as it seems to me. The user has an option to select a startdate and an enddate. My creationtime column will have to contain every month between those two dates the user had selected. That doesn't mean I will find EVERY month in the actual oracle database. However, I have to check for it and if a given month is not found I have to assign value "0" for both 1 and 2 (producttypes) and the month should still be present in the creationtime column in my dataset.
    Any tips would be welcomed.
    Thanks.

    The example is self explanatory and I wanted to make it as minimalistic as posible.It is not self explanatory. Raw data can be interpreted in a number of ways: we need to understand what these things mean. Minimalism is fine (I'm a big Phillip Glass fan myself) but too little is not good enough. For instance, is COUNT a column name or the output of a COUNT function? Are there really only two ProductTypes?
    Depending on the answers to those questions something like this query may or may not work for you...
    select creationtime
              , sum(decode(producttype,1, count, 0)) as pt1
              , sum(decode(producttype,2, count, 0)) as pt2
    from your_original_table
    group by creationtime
    /Cheers, APC
    Blog : http://radiofreetooting.blogspot.com/

  • Problem with a simple query

    Hey. I've got a table which contains only one entry:
    Table "users":
    id | date | user | pass | profile | last_logged
    1 | ... | evo | ... | ... | ...
    My query is: "SELECT * FROM users WHERE user=evo". The problem is that im always gettings a null pointer exception, but if I get the data by refering to the id (WHERE id=1) then it works! Why is this?
    I've got a login system which takes the username from the form and attempts to get the id corresponding to the user value. But it just won't work. help appreciated. Thanks.

    Is the user column of type string and evo a string value?
    Which database are you using?
    Don't you have to put single quotes around that?
    String query = "SELECT * FROM users WHERE user = 'evo'"MOD

  • Adding a column makes big difference with a simple query

    Hello All,
    The oracle environment I am working with is
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    and
    PL/SQL Release 9.2.0.8.0 - Production
    I have a question for the following 2 queries. The only difference is that first one has an extra field than the second one. That extra field makes big difference regarding excution time. One is 4 seconds and the other is 5 minutes. Could anyone help me to understand why? Thank you for your help! -Susan
    4 Seconds
    ================================================================
    select distinct B.A_CA.CA_ID, B.A_CA.CE_ID
    from B.A_CA, B.CA_LIST_DTLS
    where UPPER(deleted(B.A_CA.CA_ID) = 'N'
    and UPPER(B.CA_LIST_DTLS.CA_LIST_NAME) = 'SW'
    and B.A_CA.CA_ID = B.CA_LIST_DTLS.CA_ID ;
    5 minutes
    ==============================================================
    select distinct B.A_CA.CA_ID
    from B.A_CA, B.CA_LIST_DTLS
    where UPPER(deleted(B.A_CA.CA_ID) = 'N'
    and UPPER(B.CA_LIST_DTLS.CA_LIST_NAME) = 'SW'
    and B.A_CA.CA_ID = B.CA_LIST_DTLS.CA_ID ;
    Below is the function
    =============================================================
    FUNCTION deleted ( in_ca_id IN B.A_CA.CA_ID%TYPE ) RETURN VARCHAR2 IS
    n_result VARCHAR2(20);
    cnt NUMBER :=0;
    cursor cur is
    SELECT COUNT(*)
    from B.A_CA
    where B.A_CA.CA_ID=in_ca_id
    and (B.A_CA.COMPLAINT_FLAG = 'Y'
    or B.A_CA.DELETE_FLAG = 'Y') ;
    BEGIN
    OPEN cur;
    FETCH cur INTO cnt;
    CLOSE cur;
    If cnt >0 then
    n_result := 'Y';
    else
    n_result := 'N';
    end if;
    RETURN n_result;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    return 'N/A';
    END;
    Edited by: 849989 on Apr 5, 2011 10:25 AM

    Explain plan for two queries:
    The fast one:
    Plan
    SELECT STATEMENT CHOOSE Cost: 4,223 Bytes: 116,032 Cardinality: 2,072
    5 SORT UNIQUE Cost: 4,223 Bytes: 116,032 Cardinality: 2,072
    4 NESTED LOOPS Cost: 4,212 Bytes: 116,032 Cardinality: 2,072
    1 TABLE ACCESS FULL B.CA_LIST_DTLS Cost: 68 Bytes: 87,024 Cardinality: 2,072
    3 TABLE ACCESS BY INDEX ROWID B.A_CA Cost: 2 Bytes: 14 Cardinality: 1
    2 INDEX UNIQUE SCAN UNIQUE B.A_CA_PK Cost: 1 Cardinality: 1
    The slow one:
    Plan
    SELECT STATEMENT CHOOSE Cost: 305 Bytes: 111,888 Cardinality: 2,072
    4 SORT UNIQUE Cost: 305 Bytes: 111,888 Cardinality: 2,072
    3 HASH JOIN Cost: 295 Bytes: 111,888 Cardinality: 2,072
    1 TABLE ACCESS FULL B.CA_LIST_DTLS Cost: 68 Bytes: 87,024 Cardinality: 2,072
    2 INDEX FAST FULL SCAN UNIQUE B.A_CA_PK Cost: 225 Bytes: 131,928 Cardinality: 10,994
    Edited by: 849989 on Apr 5, 2011 11:49 AM

  • Having trouble with running simple jsf

    Hi, I am new to JSF. I am trying to run this application provided with the j2ee tutorial. I am getting a "cannot find FacesContext" Exception even though I have the mapping it in my web.xml...I have attched the error and my web.xml...any help would be great...have been braking my head over it.....My web.xml file is in the WEB-INF folder, as ever.....
    StandardWrapperValve[debugjsp]: Servlet.service() for servlet debugjsp threw exception
    javax.servlet.ServletException: Cannot find FacesContext
    javax.servlet.ServletException: Cannot find FacesContext
         at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:471)
         at org.apache.jsp.greeting$jsp._jspService(greeting$jsp.java:330)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
         at java.lang.Thread.run(Thread.java:534)
    web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>guessNumber</display-name>
    <servlet>
    <display-name>FacesServlet</display-name>
    <servlet-name>FacesServlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>FacesServlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    </web-app>

    what is the web server u r using ?
    what jars have u in the lib directory?
    I believe this is a version /configuration problem

  • I have trouble with the simple task of make a paper copy of an e-mail. There is not tab for that.

    I receive an e-mail that I want to copy, such as an airline or car reservation. There is no tab that I have found where I can copy that reservation. Don't know why there is not a prominent tab which I can press to copy the e-mail. Maybe it is there but I have not found it. Very confusing.

    I've tried to copy-paste the message, but I get only the body, not the To/From. I'd like to be able to save a thread as a .doc, but I haven't figured out a way to do that. PrntScrn copies the image of the entire screen on the monitor, including the entire Thunderbird screen, and it's an image, not editable.
    I've tried to show all headers, and I still get only the body. Only if I actually PRINT the email do I get the To/From/Subject/Date.
    Any way to copy ALL the common information about an email, to paste into another .doc?
    hilker23

  • Trouble with a simple MVC (of the design pattern)

    Below is the troublesome MVC triad (see attached error image). The problem is in the Model where I am loading data from a MySQL database using a php script. The array businessUnits is updated in the constructor. However, in the method getBusinessUnitsList(), it is not.
    package
    import flash.events.*;
    public interface IModel extends IEventDispatcher
      function getBusinessUnitsList( ):Array
      function getBusinessUnit( ):uint
      function setBusinessUnit(index:uint):void
    package
       import flash.events.EventDispatcher;
       import flash.net.URLLoader;
       import flash.net.URLRequest;
       import flash.events.Event;
       import flash.net.URLVariables;
       import flash.net.URLRequestMethod;
       import flash.net.URLLoaderDataFormat;
       public class Model extends EventDispatcher implements IModel
      protected var businessUnitsLoader:URLLoader;
      protected var businessUnits:Array;
      protected var chosenBusinessUnit:uint;
      //Constructor
      public function Model()
       businessUnitsLoader = new URLLoader();
       businessUnitsLoader.addEventListener(Event.COMPLETE, onComplete);
       businessUnitsLoader.load(new URLRequest("http://localhost/InteractiveStrategy/businessUnits.php"));
       businessUnitsLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
       function onComplete(event:Event):void
        businessUnits = businessUnitsLoader.data.businessUnits.split("*");
       trace("From constructor "+businessUnits.length)
      public function getBusinessUnitsList():Array
      trace("From method "+businessUnits.length)
       return businessUnits;
      public function getBusinessUnit( ):uint
       return this.chosenBusinessUnit;
      public function setBusinessUnit(index:uint):void
       this.chosenBusinessUnit = index;
       this.update( );
      private function update():void
       dispatchEvent(new Event(Event.CHANGE));
    package
    import flash.events.Event;
    import fl.controls.ComboBox;
    public class View extends CompositeView
      private var cb:ComboBox;
      public function View(aModel:IModel,aController:ICompInputHandler= null)
       super(aModel, aController);
       var businessUnits:Array = (model as IModel).getBusinessUnitsList( );
       cb = new ComboBox( );
       for (var i:uint = 0; i < businessUnits.length; i++)
        cb.addItem( { label: businessUnits[i].bem, data:i } );
       update( );
       addChild(cb);
      cb.addEventListener(Event.CHANGE, this.changeHandler);
      override public function update(event:Event = null):void
       cb.selectedIndex = (model as IModel).getBusinessUnit( );
       super.update(event);
      private function changeHandler(event:Event):void
       (controller as ICompInputHandler).compChangeHandler
       (ComboBox(event.target).selectedItem.data);
    package
    public class Controller implements ICompInputHandler
      private var model:Object;
      public function Controller(aModel:IModel)
       this.model = aModel;
      public function compChangeHandler(index:uint):void
       (model as IModel).setBusinessUnit(index); // update model

    I have download the NAVTEQ sample data pack and in the process of importing it, but it seems that using 700mb of data for me to ask oracle "given this point, tell me what country or ocean it is in" would be overkill.
    An option would be to load the entire data set, then delete the stuff you don't need (lower level admin boundaries, etc). Of course, at the end of the day it depends on how accurate you want your results to be. The more accurate the data, the more confidence you will have in the result.

Maybe you are looking for

  • Problem with KT4 Ultra and XP 2700

    First excuse my bad english (i'm from Germany)!! I have a heavy problem with my KT4 Ultra. First my system: AMD Athlon XP 2700 Mainboard: MSI KT4 Ultra (MS-6590) Bios vers. 1.1 MSI Geforce 4 Ti 4200 64 Mb 512 Mb DDR Ram Apacer Technology 512 MB 16x(3

  • Portlet Chart error message with page parameters

    I have a perplexing problem. We're using portal 9.0.4. I've created a chart from a sql query using the portal builder tools. It's a complicated query with two parameters that have default values defined. The chart will run as a portlet from the porta

  • P2 gen.spool; how to call it several times from P1 in Job and look spools ?

    Hi I have a Program 2  wich generates a report (list). If i create a Job (SM36) with this Program 2, the Job generates the corresponding spool. I have other Program 1 wich call several times the Program 2, but if i create a Job with this Program 1, t

  • Transpose Of The Internal Table

    I have The Data In ITAB (Internal Table ) I want To Transpose the Row To Column. Pls Any one Help me Thanks , Vijayakanth.K Moderator Message: Very generic question. Similar questions have been discussed in the forums. Try to implement the solutions

  • BI Mobile Navigation Bar

    Hi Community We have in BI Mobile several reports designed in Design Studio. That work's well, but if we open a report, the navigation Bar is hidden and we can go Back to an other report. So we have to Close the app, and Restart.. Has anyone an idea