JSP Basics query

Hello friends,
I had asked few questions in my last post of init parameters in jsp, which must have got overlooked, but the questions are still not solved. Please help me.
1) How to override jspInit() ?
I tried one sample program, but the kind of output i get is weird, which leads me to ask this question. I have written one jsp: -
Simple.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="java.io.*"  %>   
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Welcome to SWA_JSP</title>
</head>
<body>
<%!
     String classPath = "Yet to be set!";
     String realPath = "This one needs to be set too!";
     String fileSperator = File.separator;
     String libPath = "library ....ann what ?";
     public void jspInit() {
          // I am trying to override jsp init method
          System.out.println("\n\nMy try at overriding the jsp init method !");
%>
<%
     classPath = System.getProperty("java.class.path");
     realPath = application.getRealPath("");
     libPath = System.getProperty("java.library.path");
%>
<center>
<p>
<table >
     <tr>
          <td width = "25%">
               <b>
               Parameter obtained
               </b>
          </td>
          <td width = "50%">
               <b>
               Value
               </b>
          </td>
          <td width = "25%">
               <b>
               Obtained using
               </b>
          </td>
     </tr>
     <tr>
          <td>
               classpath
          </td>
          <td>
               <%= classPath %>
          </td>
          <td>
               System.getProperty("java.class.path");
          </td>
     </tr>
     <tr>
          <td>
               realpath
          </td>
          <td>
               <%= realPath %>
          </td>
          <td>
               application.getRealPath("");
          </td>
     </tr>
     <tr>
          <td width = "25%">
               Library path
          </td>
          <td width = "150px">
               <%= libPath %>
          </td>
          <td width = "25%">
               System.getProperty("java.library.path");
          </td>
     </tr>
</table>
</p>
</center>
</body>
</html>And in index.html i have a hyperlink that points to this jsp: -
index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<center>
     <p>
          <table>
               <tr>
                    <td>
                         <a href="simple.jsp">Click here</a> to find out what the classpath and <br>
                         realpath of servletcontext for the container mean ?
                    </td>
               </tr>
          </table>
     </p>
</center>
</body>
</html>Now, the scenario is as follows,
1) The index.html is loaded
2) I click on the "click here" hyperlink
3) The simple.jsp is loaded .... in the console......"My try at overriding the jsp init method !" is printed once.
4) At this moment, i again click on Refresh page button of Firefox, the simple.jsp is loaded again, and in the console it again prints .... "My try at overriding the jsp init method !" ....that means the SOP statement was printed twice!!!!
5) i again click on Refresh page button or F5 key several times, ......but from now on the SOP is not printed in the console
Thus, in the console, it only shows, the SOP statement printed twice! .... But, it should print only once, since i have overridden the jspInit() method.....and it is invoked only once......why this strange behavior ?
and my second doubt is :-
2) We have nine implicit objects, are these objects available even in declaration tags
*<%! ..... %>* also ? , ..... because i could neither use the application nor config object, not even request object in the jspInit() method.....i mean, in any normal method declared in declaration tag, the implicit objects are NOT available* ... why is it so ?
Thanks and Regards
Omkar Patkar

Hi
i got my query solved....@ [this post|http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=50&t=017658]
Thanks and Regards
Omkar Patkar

Similar Messages

  • Basic query in Oracle Spatial

    I'm trying to learn Oracle Spatial working with 11g R2 and with 3D georeferenced data (specifically data describing buildings in a city).
    But I'm having trouble getting a basic query to work on my dataset (it works for the book example), and I'm trying to do it exactly the way it's done in the Spatial Developer's Guide for 11g.
    To learn how spatial queries work, I set up the cola_markets tables used in the book, made the appropriate manual entry in the user_sdo_geom_metadata view and created the index. Having done that, I can run the following simple query (as well as the others in the manual) on the book tables:
    SELECT SDO_GEOM.SDO_DISTANCE(c_b.shape, c_d.shape, 0.005)
    FROM cola_markets c_b, cola_markets c_d
    WHERE c_b.name = 'cola_b' AND c_d.name = 'cola_d';
    but when I try to do the same thing on my own tables (created from citygml data), I get an error. There is the difference that the data is 3D, and the index was created without any PARAMETERS ( ... ), hence is just 2D. But still I don't get why the following query doesn't work:
    SELECT SDO_GEOM.SDO_DISTANCE(c_w.envelope, c_b.envelope, 0.0005)
    FROM cityobject c_w,
         cityobject c_b
    WHERE c_w.id = 50025
         AND c_b.id = 50018;
    The id's for the buildings are valid, and I used the same tolerance used by the software that set up the database.
    Here's the error I get in SQL developer:
    ORA-29532: Java call terminated by uncaught Java exception: java.lang.Exception: 54535
    ORA-06512: at "MDSYS.SDO_3GL", line 637
    ORA-06512: at "MDSYS.SDO_GEOM", line 1973
    ORA-06512: at "MDSYS.SDO_GEOM", line 1990
    29532. 00000 - "Java call terminated by uncaught Java exception: %s"
    *Cause: A Java exception or error was signaled and could not be
         resolved by the Java code.
    *Action: Modify Java code, if this behavior is not intended.
    So, thinking it might have something to do with the fact that it's a Java interface, I also tried running it from SQL/PL command line and get essentially the same thing:
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception:
    java.lang.Exception: 54535
    ORA-06512: at "MDSYS.SDO_3GL", line 637
    ORA-06512: at "MDSYS.SDO_GEOM", line 1973
    ORA-06512: at "MDSYS.SDO_GEOM", line 1990
    Any ideas why this isn't working?
    (P.S.: I couldn't find a specific board for Oracle Spatial, hence put this question here--if there's a better place for this question, then, admins, of course, feel free to move the thread to the appropriate spot)

    Hi,
    The SPATIAL forum is here : {forum:id=76}

  • Basic question - Problems with basic query - Mask = INSIDE

    Greetings,
    I'm doing a basic query on Oracle 10g Spatial, is to determine the intersection between two layers (one point called "Calidad1") and other polygons, called "Parishes")
    For issuing the following query based on the documentation of oracle:
    "select C1.ID, C1.SECUENCIA,
    P. COD_ENTIDAD, P. STATE
    Cod_county P., P. TOWNSHIP,
    P. COD_PARROQUIA, P. PARISH
    from CALIDAD1 c1,
    PARISHES p
    where sdo_relate (c1.geoloc, p.geoloc, 'mask = INSIDE querytype = WINDOW') = 'TRUE'
    order by C1.ID;
    When I run the query, no errors but extends too long (more than 10 minutes) and no end, I have to cancel.
    Canceling shows me the following error:
    "ORA-13268: error obtaining dimension from USER_SDO_GEOM_METADATA
    ORA-06512: at "MDSYS.MD", line 1723
    ORA-06512: at "MDSYS.MDERR", line 8
    ORA-06512: at "MDSYS.SDO_3GL", line 89 "
    This query is very basic and the data volume is small, a conclusion: I must be skipping a step or activity.
    Can you guide a little to resolve this situation and get the query that I need?
    Thanks to all

    First, try this query with the ordered hint and also note the change in the FROM clause.
    select /*+ ordered */ C1.ID, C1.SECUENCIA,
    P. COD_ENTIDAD, P. STATE
    Cod_county P., P. TOWNSHIP,
    P. COD_PARROQUIA, P. PARISH
    from PARISHES p,
    CALIDAD1 c1,
    where sdo_relate (c1.geoloc, p.geoloc, 'mask = INSIDE querytype = WINDOW') = 'TRUE'
    order by C1.ID;
    See if this is using the index as expected. If not try this:
    select /*+ ordered index(p name_of_the_spatial_index_on_the_PARISH_Table) */
    C1.ID, C1.SECUENCIA,
    P. COD_ENTIDAD, P. STATE
    Cod_county P., P. TOWNSHIP,
    P. COD_PARROQUIA, P. PARISH
    from PARISHES p,
    CALIDAD1 c1,
    where sdo_relate (c1.geoloc, p.geoloc, 'mask = INSIDE querytype = WINDOW') = 'TRUE'
    order by C1.ID;
    siva

  • Basic Query on CQ 5

    Hi,
    I have a basic query about CQ5 ,actually i will be getting training on it ,i have the following doubts:-
    1)I am a beginner in JAva and related technologies,does one need to be an expert in java to understand CQ5?
    2)I have mainly worked on Teamsite CMS before,how easy is it for someone from that background to adapt to DAY CQ/
    I can go through all the java concepts which are mandatory in CQ5 understanding,please guide regarding them.
    Looking forward for expert guidance.
    Regards,
    Raul

    Hi Raul,
    Here's my 2 cents:
    1)I am a beginner in JAva and related technologies,does one need to be an expert in java to understand CQ5?
    No - and - depends.  CQ is an enterprise level CMS.  As such, it has many many bits and bobs.  There is a back-end Java element, a front-end JavaScript/ExtJS element, and a bunch of stuff between the two (sling, crx, osgi, etc.).  My best recommendation would be get on a project with a skilled architect in which you are being given components or other parts/pieces to work on. That will give you hands on guidance on building CQ and direct access to seeing an entire project go up from soup-to-nuts.  Also, if you haven't already, try to get to an Adobe CQ Dev training class.  That will really help jump start your knowledge and get you off on the right foot.
    2)I have mainly worked on Teamsite CMS before,how easy is it for someone from that background to adapt to DAY CQ/
    Any previous CMS knowledge is definintely helpful.  Teamsite is VERY different to CQ.  However, the goal is the same.  Content authors need a way of entering content that ultimately gets displayed and served up as a web page.  Teamsite does this with forms whereas CQ does this more inline on the page... If you've ever worked with Teamsite Sitepublisher, that's even better.  Either way, having CMS experience is definitely helpful.
    Todd

  • Basic Query Creation

    Hello,
    Our company is about to go live with B1 and E commerce. We are very much looking forward to getting the ball rolling: the old MOM system and Sitelink shopping cart is causing issues!
    Anyway, before i go too much further i would like to get hold of some basic Query creation documentation. So far i have been unable to find any.
    If i have posted this in the wrong discussion group i apologies.
    I look forward to hearing your comments and becoming a regular in this group,
    Thanks,
    Charlie

    Hi Charlie,
    Beside this forum, you may also search and post here:
    SAP Add-Ons
    Thanks,
    Gordon

  • JSP basic questions ( i think )

    Hi, I'm new to JSP.
    I established a database connection using JSP. However, I would prefer a java connection, so I have a program called JDBCBean.java which attempts the connection. However, when I compile this and place it in my classes folder, then try to use it in my jsp file, I get a "class not found" error. This confuses me, since it IS there and I set the classpath to the folder in which it is located....
    The JDBC has : package oracle.jdbc at the top
    and in my JSP file I have, for use bean, class = "oracle.jdbc.JDBCBean".
    I can't figure out what causes my error, or how to fix it, so any help would be greatly appreciated.
    Another thing I can' quite figure is the arguements stuff. Now I can pass parameters using a form...
    For example, I tested with textbox "please enter a name". You enter a name, it then uses that parameter in the URL e.g. www.something.com/something.jsp?name=bob
    But... what I want to do is have some sort of setup where, you have, say 3 types.
    e.g. Type - 1 2 3
    And if you click on 1, the parameter would be an SQL query. e.g. Select * from x where type = '1';
    and then the page displays the results of my query.
    Is this so hard? For the life of me, I can't find such info in my book and I've hunted the net and found nothing useful. All i find is about ASP, which I think is a good bit different.
    Please help. Sample code or links or whatever would be great.
    Thanks a lot.

    Ok, classpath is irrelevant? Understood.
    This is the bean stuff i took from my book. I assume package and the class i have are correct.
    Going by these, JDBCBean.class should be located in /oracle/jdbc/ yes??
    JDBCBean.java
    package oracle.jdbc;
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    public class JDBCBean implements Serializable{
      protected transient String tableName, url;
      protected transient String query, columnNames;
      protected transient String resultTable, condn;
      protected transient String userid, password;
      protected transient Connection conn;
      public JDBCBean(){
        tableName = null;
        resultTable = null;
        condn = null;
        columnNames = null;
        resultTable = null;
        query = null;
        conn = null;
        userid = null;
        password = null;
      public void setTableName(String tableName){
        this.tableName = tableName;
      public String getTableName(){
        return tableName;
      public void setURL(String url){
        this.url = url;
      public String getURL(){
        return url;
      public void setCondn(String condn){
        this.condn = null;
        this.condn = condn;
      public String getCondn(){
        return condn;
      public void setUserid(String userid){
        this.userid = userid;
      public String getUserid(){
        return userid;
      public void setPassword(String password){
        this.password = password;
      public String getPassword(){
        return password;
      public void setColumnNames(String columnNames){
        this.columnNames = columnNames;
      public String getColumnNames(){
        return columnNames;
      public void setResultTable(String resultTable){
        this.resultTable = resultTable;
      public String getResultTable(){
        this.readTable();
        return resultTable;
      public void readTable(){
        int i = 0;
        String condition = "";
        if(columnNames == null){
          columnNames = "*";
        if(condn == null){
          condition = "";
        else{
          condition = " WHERE " + condn;
        query = "SELECT ";
            if (columnNames.charAt(0) == '*') {
              query += "* FROM " + tableName;
            } else {
            query += columnNames + " FROM " + tableName;
        if((!condition.equals(""))){
          query += condition;
        executeQuery(query);
      private void executeQuery(String query){
        if(conn == null){
          initialize();
        try{
          Statement stmt = conn.createStatement();
          ResultSet rset = stmt.executeQuery(query);
          ResultSetMetaData rsmd = rset.getMetaData();
          StringBuffer returnBuffer = new StringBuffer();
                int colNum = rsmd.getColumnCount();
                returnBuffer.append("\n\n<TABLE BORDER=\"1\" " +
                  "CELLSPACING=\"0\" CELLPADDING=\"3\">\n\t<TR>\n");
              for (int i=1; i <= colNum; i++){
                  returnBuffer.append("\t\t<TD>");
                  returnBuffer.append("<B>" +
                    rsmd.getColumnName(i) + "</B></TD>\n");
              returnBuffer.append("\t</TR>\n");
              while (rset.next()){
                returnBuffer.append("\t<TR>\n");
                for (int i=1; i <= colNum; i++)
                  returnBuffer.append("\t\t<TD>" +
                  rset.getString(i) + "</TD>\n");
                  returnBuffer.append("\t</TR>\n");
                returnBuffer.append("</TABLE>");
           resultTable = returnBuffer.toString();
           stmt.close();
           done();
        }catch(SQLException se){se.printStackTrace();}
      private void initialize(){
        try{
          Class.forName("oracle.jdbc.driver.OracleDriver");
          conn =
            DriverManager.getConnection(url, userid, password);
        }catch(SQLException se){se.printStackTrace();}
         catch(ClassNotFoundException cnfe)
                     {cnfe.printStackTrace();}
      public void done(){
        if(conn != null){
          try{
            conn.close();
          }catch(SQLException se){se.printStackTrace();}
    }JDBCBean.jsp
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Final//EN">
    <HTML>
    <BODY BGCOLOR="white">
    <% // Condn and ColumnNames are optional. Default ='*' %>
    <jsp:useBean class="oracle.jdbc.JDBCBean"
           scope="page"
           id="example" >
       <jsp:setProperty name="example"
           property="URL"
           value="jdbc:oracle:thin:@mysite:myport:xxx" />
       <jsp:setProperty name="example"
           property="Userid"
           value="me" />
       <jsp:setProperty name="example"
           property="Password"
           value="mypassword" />
       <jsp:setProperty name="example"
           property="TableName"
           value="system_users" />
       <jsp:setProperty name="example"
           property="ColumnNames"
           value="*" />
       <jsp:setProperty name="example"
           property="Condn"
           value="first_name != 'Bill'" />
       <jsp:getProperty name="example"
           property="ResultTable" />
    </jsp:useBean>
    </BODY>
    </HTML>I haven't really modified the code yet, as I want to establish a working java connection first.
    By the second part, what I meant was :
    You have something like "select a type" and then you have the options - 1, 2 , 3.
    If you choose 1, I want it to execute a query which will then display everything of type 1 on the page. e.g. pass the parameter (select * from table where type = '1';)
    Basically, your page would then be "refreshed" displaying the data your query produces, using another bean I presume.
    Thanks!

  • Basic query in JAVA Threads....Please reply !!

    I have a class (say ABC) which extends Thread...This class basically
    reads some file which provides some start-time and stop-time information..
    File structure is like:-
    ===========================================
    <Entry1>Starttime = A and Stoptime = B
    ===========================================
    Logic is that thread sleeps till time A arrived, then do some operations (which are written
    in it's run() method) till stoptime..
    The object of ABC class is being constructed in some other class.
    Now there is a change....File can have multiple entries like..
    ======================================
    <Entry1>starttime = A and stoptime = B
    <Entry2>starttime = X and stoptime = Z
    <Entry3>starttime = A and stoptime = B
    <Entryn>starttime = X and stoptime = Z
    ======================================
    The start-time and stop-time of any two Entries can be same or different.
    The operations should start executing at the defined time..
    In this case, multiple threads are required, which can do the operations
    mentioned in Entry1,2 etc.....But how should it be implemented..
    My query is:-
    1) Can I have a common-wrapper class, which reads the file and based on
    the number of Entries, instantiates that much number of threads...
    But how to do that....I am new to JAVA...Should that class be a simple
    class...or should it also implement Thread/Runnable interface.....
    Or can I implement it as ThreadGroup......
    Please give soem suggestions....Thanks...

    e.g.
            ScheduledExecutorService exec = Executors.newScheduledThreadPool(2);
            exec.schedule(new Runnable() {
                public void run() {
                    runTask();
            }, delay, TimeUnit.MILLISECONDS);

  • Help with a basic query

    Hello
    I am looking at a set of records and need to query them but cannot work out what syntax to use to get the desired result.
    This is the query for the basic data
    SELECT
    SCE_STUC,
    SCE_CRSC,
    SCE_STAC
    FROM SRS_SCE
    WHERE SCE_AYRC = '2009/0'
    and Sce_stuc LIKE '0702794'
    This gives:
    SCE_STUC SCE_CRSC SCE_STAC
    0702794     OAKC3ZSKG     C
    0702794     UBSH1BINS W
    0702794     UBSH1WIDS C
    So I need to create a query that shows where a person (sce_stuc) has a C status for sce_crsc OAKC3ZSKG but also has another SCE_CRSC not OAKC3ZSKG that is not status C.
    I am using Oracle SQL developer btw
    Any help much appreciated

    Hi thanks for these
    So I am looking for people that are C on course OAKC3ZSKG but have a record that is not C for another course this could be an In ('W','N') etc.
    Sorry I have not been that clear so looking to return:
    SCE_STUC SCE_CRSC SCE_STAC
    *0702794     UBSH1BINS      W*
    where the student has
    SCE_STUC SCE_CRSC SCE_STAC
    0702794     OAKC3ZSKG     C
    0702794     OAKC3ZSKG     C
    0702794     UBSH1BINS     W
    Again many thanks

  • Basic query regarding work-area and select query

    hi
    dear sdn members,
    thanks too all for solving all my query's up till now
    i am stuck in a problem need help
    1)  why basically work-area has been used ? the sole purpose
    2)  different types of select query ? only coding examples
    note: no links pls
    regards,
    virus

    hi,
    Work Area
    Description for a data object that is particularly useful when working with internal tables or database tables as a source for changing operations or a target for reading operations.
    WORKAREA is a structure that can hold only one record at a time. It is a collection of fields. We use workarea as we cannot directly read from a table. In order to interact with a table we need workarea. When a Select Statement is executed on a table then the first record is read and put into the header of the table and from there put into the header or the workarea(of the same structure as that of the table)of the internal table and then transferred top the body of the internal table or directly displayed from the workarea.
    Each row in a table is a record and each column is a field.
    While adding or retrieving records to / from internal table we have to keep the record temporarily.
    The area where this record is kept is called as work area for the internal table. The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.
    Header line is a implicit work area for the internal table. It depends on how the internal table is declared that the itab will have the header line or not.
    .g.
    data: begin of itab occurs 10,
    ab type c,
    cd type i,
    end of itab. " this table will have the header line.
    data: wa_itab like itab. " explicit work area for itab
    data: itab1 like itab occurs 10. " table is without header line.
    The header line is a field string with the same structure as a row of the body, but it can only hold a single row.
    It is a buffer used to hold each record before it is added or each record as it is retrieved from the internal table. It is the default work area for the internal table.
    With header line
    SELECT.
    Put the curson on that word and press F1 . You can see the whole documentation for select statements.
    select statements :
    SELECT result
    FROM source
    INTO|APPENDING target
    [[FOR ALL ENTRIES IN itab] WHERE sql_cond]
    Effect
    SELECT is an Open-SQL-statement for reading data from one or several database tables into data objects.
    The select statement reads a result set (whose structure is determined in result ) from the database tables specified in source, and assigns the data from the result set to the data objects specified in target. You can restrict the result set using the WHERE addition. The addition GROUP BY compresses several database rows into a single row of the result set. The addition HAVING restricts the compressed rows. The addition ORDER BY sorts the result set.
    The data objects specified in target must match the result set result. This means that the result set is either assigned to the data objects in one step, or by row, or by packets of rows. In the second and third case, the SELECT statement opens a loop, which which must be closed using ENDSELECT. For every loop pass, the SELECT-statement assigns a row or a packet of rows to the data objects specified in target. If the last row was assigned or if the result set is empty, then SELECT branches to ENDSELECT . A database cursor is opened implicitly to process a SELECT-loop, and is closed again when the loop is ended. You can end the loop using the statements from section leave loops.
    Up to the INTO resp. APPENDING addition, the entries in the SELECTstatement define which data should be read by the database in which form. This requirement is translated in the database interface for the database system´s programming interface and is then passed to the database system. The data are read in packets by the database and are transported to the application server by the database server. On the application server, the data are transferred to the ABAP program´s data objects in accordance with the data specified in the INTO and APPENDING additions.
    System Fields
    The SELECT statement sets the values of the system fields sy-subrc and sy-dbcnt.
    sy-subrc Relevance
    0 The SELECT statement sets sy-subrc to 0 for every pass by value to an ABAP data object. The ENDSELECT statement sets sy-subrc to 0 if at least one row was transferred in the SELECT loop.
    4 The SELECT statement sets sy-subrc to 4 if the result set is empty, that is, if no data was found in the database.
    8 The SELECT statement sets sy-subrc to 8 if the FOR UPDATE addition is used in result, without the primary key being specified fully after WHERE.
    After every value that is transferred to an ABAP data object, the SELECT statement sets sy-dbcnt to the number of rows that were transferred. If the result set is empty, sy-dbcnt is set to 0.
    Notes
    Outside classes, you do not need to specify the target area with INTO or APPENDING if a single database table or a single view is specified statically after FROM, and a table work area dbtab was declared with the TABLES statement for the corresponding database table or view. In this case, the system supplements the SELECT-statement implicitly with the addition INTO dbtab.
    Although the WHERE-condition is optional, you should always specify it for performance reasons, and the result set should not be restricted on the application server.
    SELECT-loops can be nested. For performance reasons, you should check whether a join or a sub-query would be more effective.
    Within a SELECT-loop you cannot execute any statements that lead to a database commit and consequently cause the corresponding database cursor to close.
    SELECT - result
    Syntax
    ... lines columns ... .
    Effect
    The data in result defines whether the resulting set consists of multiple rows (table-like structure) or a single row ( flat structure). It specifies the columns to be read and defines their names in the resulting set. Note that column names from the database table can be changed. For single columns, aggregate expressions can be used to specify aggregates. Identical rows in the resulting set can be excluded, and individual rows can be protected from parallel changes by another program.
    The data in result consists of data for the rows lines and for the columns columns.
    SELECT - lines
    Syntax
    ... { SINGLE }
    | { { } } ... .
    Alternatives:
    1. ... SINGLE
    2. ... { }
    Effect
    The data in lines specifies that the resulting set has either multiple lines or a single line.
    Alternative 1
    ... SINGLE
    Effect
    If SINGLE is specified, the resulting set has a single line. If the remaining additions to the SELECT command select more than one line from the database, the first line that is found is entered into the resulting set. The data objects specified after INTO may not be internal tables, and the APPENDING addition may not be used.
    An exclusive lock can be set for this line using the FOR UPDATE addition when a single line is being read with SINGLE. The SELECT command is used in this case only if all primary key fields in logical expressions linked by AND are checked to make sure they are the same in the WHERE condition. Otherwise, the resulting set is empty and sy-subrc is set to 8. If the lock causes a deadlock, an exception occurs. If the FOR UPDATE addition is used, the SELECT command circumvents SAP buffering.
    Note
    When SINGLE is being specified, the lines to be read should be clearly specified in the WHERE condition, for the sake of efficiency. When the data is read from a database table, the system does this by specifying comparison values for the primary key.
    Alternative 2
    Effect
    If SINGLE is not specified and if columns does not contain only aggregate expressions, the resulting set has multiple lines. All database lines that are selected by the remaining additions of the SELECT command are included in the resulting list. If the ORDER BY addition is not used, the order of the lines in the resulting list is not defined and, if the same SELECT command is executed multiple times, the order may be different each time. A data object specified after INTO can be an internal table and the APPENDING addition can be used. If no internal table is specified after INTO or APPENDING, the SELECT command triggers a loop that has to be closed using ENDSELECT.
    If multiple lines are read without SINGLE, the DISTINCT addition can be used to exclude duplicate lines from the resulting list. If DISTINCT is used, the SELECT command circumvents SAP buffering. DISTINCT cannot be used in the following situations:
    If a column specified in columns has the type STRING, RAWSTRING, LCHAR or LRAW
    If the system tries to access pool or cluster tables and single columns are specified in columns.
    Note
    When specifying DISTINCT, note that you have to carry out sort operations in the database system for this.
    SELECT - columns
    Syntax
    | { {col1|aggregate( col1 )}
    {col2|aggregate( col2 )} ... }
    | (column_syntax) ... .
    Alternatives:
    1. ... *
    2. ... {col1|aggregate( col1 )}
    {col2|aggregate( col2 )} ...
    3. ... (column_syntax)
    Effect
    The input in columns determines which columns are used to build the resulting set.
    Alternative 1
    Effect
    If * is specified, the resulting set is built based on all columns in the database tables or views specified after FROM, in the order given there. The columns in the resulting set take on the name and data type from the database tables or views. Only one data object can be specified after INTO.
    Note
    If multiple database tables are specified after FROM, you cannot prevent multiple columns from getting the same name when you specify *.
    Alternative 2
    ... {col1|aggregate( col1 )}
    {col2|aggregate( col2 )} ...
    Effect
    A list of column labels col1 col2 ... is specified in order to build the resulting list from individual columns. An individual column can be specified directly or as an argument of an aggregate function aggregate. The order in which the column labels are specified is up to you and defines the order of the columns in the resulting list. Only if a column of the type LCHAR or LRAW is listed does the corresponding length field also have to be specified directly before it. An individual column can be specified multiple times.
    The addition AS can be used to define an alternative column name a1 a2 ... with a maximum of fourteen digits in the resulting set for every column label col1 col2 .... The system uses the alternative column name in the additions INTO|APPENDING CORRESPONDING FIELDS and ORDER BY. .
    Column labels
    The following column labels are possible:
    If only a single database table or a single view is specified after FROM, the column labels in the database table - that is, the names of the components comp1 comp2... - can be specified directly for col1 col2 ... in the structure of the ABAP Dictionary.
    If the name of the component occurs in multiple database tables of the FROM addition, but the desired database table or the view dbtab is only specified once after FROM, the names dbtab~comp1 dbtab~comp2 ... have to be specified for col1 col2 .... comp1 comp2 ... are the names of the components in the structure of the ABAP Dictionary.
    If the desired database table or view occurs multiple times after FROM, the names tabalias~comp1 tabalias~comp2 ... have to be specified for col1 col2 .... tabalias is the alternative table name of the database table or view defined after FROM, and comp1 comp2 ... are the names of the components in the structure of the ABAP Dictionary.
    The data type of a single column in the resulting list is the datatype of the corresponding component in the ABAP Dictionary. The corresponding data object after INTO or APPENDING has to be selected accordingly.
    Note
    If multiple database tables are specified after FROM, you can use alternative names when specifying single columns to avoid having multiple columns with the same name.
    Example
    Read specific columns of a single row.
    DATA wa TYPE spfli.
    SELECT SINGLE carrid connid cityfrom cityto
    INTO CORRESPONDING FIELDS OF wa
    FROM spfli
    WHERE carrid EQ 'LH' AND connid EQ '0400'.
    IF sy-subrc EQ 0.
    WRITE: / wa-carrid, wa-connid, wa-cityfrom, wa-cityto.
    ENDIF.
    Alternative 3
    ... (column_syntax)
    Effect
    Instead of static data, a data object column_syntax in brackets can be specified, which, when the command is executed, either contains the syntax shown with the static data, or is initial. The data object column_syntax can be a character-type data object or an internal table with a character-type data type. The syntax in column_syntax, like in the ABAP editor, is not case-sensitive. When specifying an internal table, you can distribute the syntax over multiple rows.
    If column_syntax is initial when the command is executed, columns is implicitly set to * and all columns are read.
    If columns are specificied dynamically without the SINGLE addition, the resulting set is always regarded as having multiple rows.
    Notes
    Before Release 6.10, you could only specify an internal table with a flat character-type row type for column_syntax with a maximum of 72 characters. Also, before Release 6.10, if you used the DISTINCT addition for dynamic access to pool tables or cluster tables, this was ignored, but since release 6.10, this causes a known exception.
    If column_syntax is an internal table with header line, the table body and not the header line is evaluated.
    Example
    Read out how many flights go to and from a city. The SELECT command is implemented only once in a sub-program. The column data, including aggregate function and the data after GROUP BY, is dynamic. Instead of adding the column data to an internal l_columns table, you could just as easily concatenate it in a character-type l_columns field.
    PERFORM my_select USING `CITYFROM`.
    ULINE.
    PERFORM my_select USING `CITYTO`.
    FORM my_select USING l_group TYPE string.
    DATA: l_columns TYPE TABLE OF string,
    l_container TYPE string,
    l_count TYPE i.
    APPEND l_group TO l_columns.
    APPEND `count( * )` TO l_columns.
    SELECT (l_columns)
    FROM spfli
    INTO (l_container, l_count)
    GROUP BY (l_group).
    WRITE: / l_count, l_container.
    ENDSELECT.
    ENDFORM.
    SELECT - aggregate
    Syntax
    ... { MAX( col )
    | MIN( col )
    | AVG( col )
    | SUM( col )
    | COUNT( DISTINCT col )
    | COUNT( * )
    | count(*) } ... .
    Effect
    As many of the specified column labels as you like can be listed in the SELECT command as arguments of the above aggregate expression. In aggregate expressions, a single value is calculated from the values of multiple rows in a column as follows (note that the addition DISTINCT excludes double values from the calculation):
    MAX( col ) Determines the maximum value of the value in the column col in the resulting set or in the current group.
    MIN( col ) Determines the minimum value of the content of the column col in the resulting set or in the current group.
    AVG( col ) Determines the average value of the content of the column col in the resulting set or in the current group. The data type of the column has to be numerical.
    SUM( col ) Determines the sum of the content of the column col in the resulting set or in the current group. The data type of the column has to be numerical.
    COUNT( DISTINCT col ) Determines the number of different values in the column col in the resulting set or in the current group.
    COUNT( * ) (or count(*)) Determines the number of rows in the resulting set or in the current group. No column label is specified in this case.
    If you are using aggregate expressions, all column labels that are not listed as an argument of an aggregate function are listed after the addition GROUP BY. The aggregate functions evaluate the content of the groups defined by GROUP BY in the database system and transfer the result to the combined rows of the resulting set.
    The data type of aggregate expressions with the function MAX, MIN or SUM is the data type of the corresponding column in the ABAP Dictionary. Aggregate expressions with the function AVG have the data type FLTP, and those with COUNT have the data type INT4. The corresponding data object after INTO or APPENDING has to be selected accordingly.
    Note the following points when using aggregate expressions:
    If the addition FOR ALL ENTRIES is used in front of WHERE, or if cluster or pool tables are listed after FROM, no other aggregate expressions apart from COUNT( * ) can be used.
    Columns of the type STRING or RAWSTRING cannot be used with aggregate functions.
    When aggregate expressions are used, the SELECT command makes it unnecessary to use SAP buffering.
    Null values are not included in the calculation for the aggregate functions. The result is a null value only if all the rows in the column in question contain the null value.
    If only aggregate expressions are used after SELECT, the results set has one row and the addition GROUP BY is not necessary. If a non-table type target area is specified after INTO, the command ENDSELECT cannot be used together with the addition SINGLE. If the aggregate expression count( * ) is not being used, an internal table can be specified after INTO, and the first row of this table is filled.
    If aggregate functions are used without GROUP BY being specified at the same time, the resulting set also contains a row if no data is found in the database. If count( * ) is used, the column in question contains the value 0. The columns in the other aggregate functions contain initial values. This row is assigned to the data object specified after INTO, and unless count( * ) is being used exclusively, sy-subrc is set to 0 and sy-dbcnt is set to 1. If count( *) is used exclusively, the addition INTO can be omitted and if no data can be found in the database, sy-subrc is set to 4 and sy-dbcnt is set to 0.
    if helpful reward points

  • Help on JSP Basic

    Hi ALL ,
    Can any one help me on Basic JSP.
    Question:
    I have a jsp page called page.jsp and 123.jsp.. in 123.jsp i have a Hyper link Called HLINK if user click that link ... contents in the page.jsp as to be displayed in the 123.jsp page just below the Hlink.. it is possible or what ... if possible any help over this..
    Thanks in advance
    Regards
    Vicky

    Hi,
    Thanks for your reply..
    Could u pl . tell me how to set that Hlink target to the frame...
    Regards
    Vicky

  • A basic query with respect to using Message Selectors in JMS

    Hi
    When i am going MEssage Selectors topic in web , it seems very confusing for me .
    I have written a simple JMS Application based on Weblogic as my Queue .
    I have two Java Files one for Message Producer and another file acting as Message Consumer using MDB
    I have a basic TextMessage with some header properties in my Producer file .
    Please tell me in what file should i put MessageSelector ??.
    Thanks for reading .
    Please clarify my query on this .

    Thank you very much .
    I found the code of a MDB making useage of a Selector .
    *<message-driven>*
    *     <message-selector>shirtType = 'polo'</message-selector>*
    *     </message-driven>*
    Assume that i written a MDB that listens to particular type of Messages (Polo in this case ) .
    Please tell me what happens to other messages in the Queue that were never listened by the MDB .
    Thank you .

  • JSP HTML Query String

    Hi I am using query strings to pass variables such as groupName=Bonza.
    However, I don't want the user to see this string so i was wondering if there is a simple way for the JSP or HTML page to encrypt or hide or mangle the query string, so instead of:
    http://localhost:8080/jsp/newGroup.jsp?groupName=Bonza
    i could have:
    http://localhost:8080/jsp/newGroup.jsp?7thsgs7393j38dx
    Something like that anyway, at least so i could decrypt at the processing JSP page. The information doesn't need to be secure, just so ppl can't see the names of groups and change the query string.
    Thanks!

    A few ways you can do this is to:
    1) Use a form and specify POST to pass the data to the next page. The HTTP specification calls for passing the data in the header.
    2) Use hidden fields on the page.
    3) Use JSP sessions and use a bean to access the data from any page in your application implementing session.
    The last method is prbably the better method and is what I used for my recent application. This requires that the client accept cookies so that you can track the user session. The first 2 do not.

  • Basic query abt business logic

    i need to have a website which will search from a database and display results is it advisable to have my business logic (i.e database query)in servlet only since it is a small aplication or i should have a different file for business logic?
    I am very new to this technologies no do not have much knowledge.
    i am thinking to use jsp for display since it automatically handles sessions.
    tia

    so i should have my database query logic
    based on search parameters in my servlet only???No
    should have a different file for business logic?Yes. Your servlet can create an object of a Search class(in a different file) and call its methods to do the searching. Then your servlet can attach the result to the request:
    request.setAttribute("someName", SearchResults);and then forward the request to the JSP using a RequestDispatcher:
    RequestDispatcher view = request.getRequestDispatcher("/results.jsp");
    view.forward(request, response);Then your jsp can retrieve the data:
    SearchResults data  = (SearchResults) request.getAttribute("someName");MVC. Model View Controller:
    Controller = servlet
    Model = Search class
    View = jsp
    Your directory structure might look something like this:
    yourApp
    --searchForm.htm
    --results.jsp
    --WEB-INF
    -------classes
    -----------com
    ---------------myWebsite
    --------------------web
    --------------------------MyServlet.class (package com.myWebsite.web;)
    --------------------model
    --------------------------Search.class (package com.myWebsite.model;)

  • JSP Data Query tag and case sensistivity

    Hello,
    When using BC4J Data Query tag in JSP apps how to make queries case INSENSITIVE? I undestand that string comparison in Oracle is case sensiteve and hence my dynamic query will be also. However, I would like to do something like
    select * from bla
    where upper(attribute) = upper(string) where the string is from the JSP query form entered by user.
    rade

    Use a standard INPUT tag combined with the DataValue tag. This will allow you to control the input tag while still getting the data from a BC4J attribute.

  • A lot of trace events on a basic query

    Hi All,
    We are struggling with a strange olap engine behavior on resolving basic MDX query on any measure
    even without any dimensions attributes involved. (on clear cache) 
    Enormous amount of Starting/Finishing Reading from Aggregation 0 emitted. (Progress Report Event; 14-Query sub event).
    We commented out all mdx script and enabled one native measure (count),
    but this take no effect. The product version is 2012 sp2.
    Has anyone ever met this issue before? 

    Hi Dimitri,
    According to your description, you can't execute MDX query at all. Right?
    In this scenario, pelase make sure the SSAS database is not corrupt. Re-deploy your cube and see if any error is thrown. Check the data in tables which are involved in dsv. You can use SQL query to join those tables and query the data in SSMS database engine.
    Go to SQL Server Configuration Manager and Services to see if SQL Server Analysis Services is running. And make sure the log on account has suffcient permission. If possbile please share some sample query and the detail error message.
    Simon Hou
    TechNet Community Support

Maybe you are looking for

  • Install Windows 8.1 BootCamp drivers on old MacBook (Late 2008)

    Here is how I installed BootCamp drivers for 8.1 on my old MakBook (Late 2008): Download Boot Camp 4.0.4033 (Drivers for old MacBook is in this version) Install Windows 7, then WIndows 8.1 (There are other threads on how to do that). After Windows 8.

  • Problem updating the Adobe Creative Cloud Apps

    Hi, I have recently subscribed Adobe Creative Cloud (for student and teachers). All the programs are working fine since then but there is a problem. I cannot update any of these applications. I have my internet connection 24/7, and my pc meets all th

  • Skinning of parameter "empty text " in table.

    hi everyone, How to do styling of empty text of default text in table .(It comes when there is no data in the table) such as "No data to display" ,I want to change its font ,font size etc. Please help.

  • How to make a leader board in as3

    I've been searching for online tutorials and can only find ones really for as2. If anyone could give me a link to a tutorial or help me, that'd be great!

  • How to add volume meter in Windows Form Application?

    Assalam-u-Alaikum everyone! I've started working on Speech Recognition technology for my final year project. I am required to make a Speech Recognition System for Windows. I want to add volume meter in my software to see how loud the user is speaking