Select command on sqlplus

Hello,
We have our first Oracle database here, and I'm finding some problems to deal with sqlplus.
When I start a select command to list the rows from a table which has 567 rows, I have a very big answer and I'm not able to see the first columns...
I'd like to know how I can obtain the answer page by page...
Is this possible ?
Eduardo

try:
set pagesize 10This will give you a header every ten lines.
Of course, you may ALSO have to do
set linesize 120or something based on your screen size.
and also, you may have to set each columns (that you are selecting like this
col some_column_name format a10This will format it to 20 characters eventhough the column is defined as let's say varchar2(100).

Similar Messages

  • Copy command of SQLPLUS is failing

    Oracle Version 8i.
    When trying to use the copy command -in SQLPLUS- to copy the data from one database to the other, I am encountering the following error.
    Error: SP2-0027: Input is too long (> 2499 characters) - line ignored
    Reason for using the copy command is: Allows me to set commit points as against Insert into ... select * from command.
    The table, I am copying has lot of columns and the number of characters in the script are more than 3000.
    Where is the restriction of 2499 characters set? Is there a way to alter this?
    Thanks
    null

    You can export the table(s) and import into your database.

  • Executing commands in sqlplus

    I trying to get an explanation as to what is the difference between using semicolon or slash when running commands in sqlplus?
    Thx.

    ; - executes the command
    /(slash) executes the command or block in the buffer and will not display the command.
    SQL> select sysdate from dual;
    SYSDATE
    14-OCT-09
    SQL> ;
      1* select sysdate from dual
    SQL> /
    SYSDATE
    14-OCT-09-Anantha

  • SHOW commands in SQLPlus

    Where can I find a list / explanation of the SHOW commands in SQLPlus?
    Thanks,

    Hi,
    Also, try this cool glogin script from Chris Foot to show the instance name in your SQL*Plus promt:
    COLUMN file_name FORMAT a44
    COLUMN tablespace_name FORMAT a20
    COLUMN owner FORMAT a15
    COLUMN segment_name FORMAT a20
    set lines 132
    set pages 100
    set termout off
    col dbname new_value prompt_dbname
    select instance_name dbname from v$instance;
    set sqlprompt "&&prompt_dbname> "
    set termout on
    set time on
    Here are the set options:
    APPI[NFO]ON
    Application info for performance monitor (see DBMS_APPLICATION_INFO)
    ARRAY[SIZE] {15|n}
    Fetch size (1 to 5000) the number of rows that will be retrieved in one go.
    AUTO[COMMIT] OFF|n}
    Autocommit commits after each SQL command or PL/SQL block
    AUTOP[RINT] OFF
    Automatic PRINTing of bind variables.(see PRINT)
    AUTORECOVERY ON
    Configure the RECOVER command to automatically apply
    archived redo log files during recovery - without any user confirmation.
    AUTOT[RACE] OFF} [EXP[LAIN]] [STAT[ISTICS]]
    Display a trace report for SELECT, INSERT, UPDATE or DELETE statements
    EXPLAIN shows the query execution path by performing an EXPLAIN PLAN.
    STATISTICS displays SQL statement statistics.
    Using ON or TRACEONLY with no explicit options defaults to EXPLAIN STATISTICS
    BLO[CKTERMINATOR] {.|c|OFF|ON}
    Set the non-alphanumeric character used to end PL/SQL blocks to c
    CMDS[EP] {;|c|OFF|ON}
    Change or enable command separator - default is a semicolon (;)
    COLSEP { |text}
    The text to be printed between SELECTed columns normally a space.
    COM[PATIBILITY] {V5|V6|V7|V8|NATIVE}
    Version of oracle - see also init.ora COMPATIBILITY=
    You can set this back by up to 2 major versions e.g. Ora 9 supports 8 and 7
    CON[CAT] {.|c|OFF|ON}
    termination character for substitution variable reference
    default is a period.
    COPYC[OMMIT] {0|n}
    The COPY command will fetch n batches of data between commits.
    (n= 0 to 5000) the size of each fetch=ARRAYSIZE.
    If COPYCOMMIT = 0, COPY will commit just once - at the end.
    COPYTYPECHECK OFF
    Suppres the comparison of datatypes while inserting or appending to DB2
    DEF[INE] {&|c|OFF|ON}
    c = the char used to prefix substitution variables.
    ON or OFF controls whether to replace substitution variables with their values.
    (this overrides SET SCAN)
    DESCRIBE [DEPTH {1|n|ALL}][LINENUM {ON|OFF}][INDENT {ON|OFF}]
    Sets the depth of the level to which you can recursively describe an object
    (1 to 50) see the DESCRIBE command
    ECHO OFF
    Display commands as they are executed
    EMB[EDDED] OFF
    OFF = report printing will start at the top of a new page.
    ON = report printing may begin anywhere on a page.
    ESC[APE] {\|c|OFF|ON}
    Defines the escape character. OFF undefines. ON enables.
    FEED[BACK] {6|n|OFF|ON}
    Display the number of records returned (when rows > n )
    OFF (or n=0) turns the display off
    ON sets n=1
    FLAGGER OFF|FULL}
    Checks to make sure that SQL statements conform to the ANSI/ISO SQL92 standard.
    non-standard constructs are flagged as errors and displayed
    See also ALTER SESSION SET FLAGGER.
    FLU[SH] OFF
    Buffer display output (OS)
    (no longer used in Oracle 9)
    HEA[DING] OFF
    print column headings
    HEADS[EP] {||c|OFF|ON}
    Define the heading separator character (used to divide a column heading onto > one line.)
    OFF will actually print the heading separator char
    see also: COLUMN command
    INSTANCE [instance_path|LOCAL]
    Change the default instance for your session, this command may only be issued when
    not already connected and requires Net8
    LIN[ESIZE] {150|n}
    Width of a line (before wrapping to the next line)
    Earlier versions default to 80, Oracle 9 is 150
    LOBOF[FSET] n
    Starting position from which CLOB and NCLOB data is retrieved and displayed
    LOGSOURCE [pathname]
    Change the location from which archive logs are retrieved during recovery
    normally taken from LOG_ARCHIVE_DEST
    LONG {80|n}
    Set the maximum width (in chars) for displaying and copying LONG values.
    LONGC[HUNKSIZE] {80|n}
    Set the fetch size (in chars) for retrieving LONG values.
    MARK[UP] HTML ON
    [HEAD text] [BODY text] [TABLE text]
    [ENTMAP {ON|OFF}][SPOOL {ON|OFF}]
    [PRE[FORMAT] ON]
    Output HTML text, which is the output used by iSQL*Plus.
    NEWP[AGE] {1|n} NULL text
    The number of blank lines between the top of each page and the top title.
    0 = a formfeed between pages.
    NULL text
    Replace a null value with 'text'
    The NULL clause of the COLUMN command will override this for a given column.
    NUMF[ORMAT] format
    The default number format.
    see COLUMN FORMAT.
    NUM[WIDTH] {10|n}
    The default width for displaying numbers.
    PAGES[IZE] {14|n}
    The height of the page - number of lines.
    0 will suppress all headings, page breaks, titles
    PAU[SE] OFF
    press [Return] after each page
    enclose text in single quotes
    RECSEP {WR[APPED]|EA[CH]|OFF}
    Print a single line of the RECSEPCHAR between each record.
    WRAPPED = print only for wrapped lines
    EACH=print for every row
    RECSEPCHAR {_|c}
    Define the RECSEPCHAR character, default= ' '
    SCAN OFF
    OFF = disable substitution variables and parameters
    SERVEROUT[PUT] OFF [SIZE n] [FOR[MAT] {WRA[PPED]|WOR[D_WRAPPED]|TRU[NCATED]}]
    whether to display the output of stored procedures (or PL/SQL blocks)
    i.e., DBMS_OUTPUT.PUT_LINE
    SIZE = buffer size (2000-1,000,000) bytes
    SHOW[MODE] OFF
    Display old and new settings of a system variable
    SPA[CE] {1|n}
    The number of spaces between columns in output (1-10)
    SQLBL[ANKLINES] ON
    Allow blank lines within an SQL command. reverts to OFF after the curent command/block.
    SQLC[ASE] {MIX[ED]|LO[WER]|UP[PER]}
    Convert the case of SQL commands and PL/SQL blocks
    (but not the SQL buffer itself)
    SQLPLUSCOMPAT[IBILITY] {x.y[.z]}
    Set the behavior or output format of VARIABLE to that of the
    release or version specified by x.y[.z].
    SQLCO[NTINUE] {> |text}
    Continuation prompt (used when a command is continued on an additional line using a hyphen -)
    SQLN[UMBER] OFF
    Set the prompt for the second and subsequent lines of a command or PL/SQL block.
    ON = set the SQL prompt = the line number.
    OFF = set the SQL prompt = SQLPROMPT.
    SQLPRE[FIX] {#|c}
    set a non-alphanumeric prefix char for immediately executing one line of SQL (#)
    SQLP[ROMPT] {SQL>|text}
    Set the command prompt.
    SQLT[ERMINATOR] {;|c|OFF|ON}|
    Set the char used to end and execute SQL commands to c.
    OFF disables the command terminator - use an empty line instead.
    ON resets the terminator to the default semicolon (;).
    SUF[FIX] SQL
    Default file extension for SQL scripts
    TAB OFF
    Format white space in terminal output.
    OFF = use spaces to format white space.
    ON = use the TAB char.
    Note this does not apply to spooled output files.
    The default is system-dependent. Enter SHOW TAB to see the default value.
    TERM[OUT] OFF
    OFF suppresses the display of output from a command file
    ON displays the output.
    TERMOUT OFF does not affect the output from commands entered interactively.
    TI[ME] OFF
    Display the time at the command prompt.
    TIMI[NG] OFF
    ON = display timing statistics for each SQL command or PL/SQL block run.
    OFF = suppress timing statistics
    TRIM[OUT] OFF
    Display trailing blanks at the end of each line.
    ON = remove blanks, improving performance
    OFF = display blanks.
    This does not affect spooled output.
    SQL*Plus ignores TRIMOUT ON unless you set TAB ON.
    TRIMS[POOL] ON
    Allows trailing blanks at the end of each spooled line.
    This does not affect terminal output.
    UND[ERLINE] {-|c|ON|OFF}
    Set the char used to underline column headings to c.
    VER[IFY] OFF
    ON = list the text of a command before and after replacing substitution variables with values.
    OFF = dont display the command.
    WRA[P] OFF
    Controls whether to truncate or wrap the display of long lines.
    OFF = truncate
    ON = wrap to the next line
    The COLUMN command (WRAPPED and TRUNCATED clause) can override this for specific columns.

  • SELECT command denied

    Hi guys,
    We have an issue about toplink. We have two enviroments, a developer enviroment glassfish 2.1, windows xp and java 1.6. Our application have toplink essentials, JPA and some entities mapped. In developer enviroment it all works done but in test enviroment we cant execute any query! And we cant understand why, we talk with our DBA and he got all grants to user but we have allways same problem:
    [#|2009-12-30T12:31:03.562-0300|WARNING|sun-appserver2.1|oracle.toplink.essentials.session.file:/opt/glassfish/domains/domain1/applications/j2ee-apps/kmonitor-EAR/KMonitor-ejb_jar/-KMonitor|_ThreadID=225;_ThreadName=p: thread-pool-1; w: 196;_RequestID=fda25a98-2c3a-43d0-ae4e-4a1c1cd3167f;|
    Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.1 (Build b31g-fcs (10/19/2009))): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: SELECT command denied to user 'km_dsv'@'cassini' for table 'fontestatus'
    Error Code: 1142
    Call: SELECT id_fontestatus, criacao, usuario_criacao, nome, alteracao, codigo, usuario_alteracao, descricao FROM kmonitor.fontestatus WHERE (id_fontestatus = ?)
         bind => [1]
    Query: ReadObjectQuery(com.knowtec.suiteic.kmonitor.informacao.entity.Fontestatus)
    Its the first query and its executed from JPA... we use mysql database.
    Here persistence.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
    <persistence-unit name="KMonitor" transaction-type="JTA">
    <jta-data-source>jdbc/kmonitor</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties/>
    </persistence-unit>
    <persistence-unit name="KMonitor-standalone" transaction-type="RESOURCE_LOCAL">
    <non-jta-data-source>jdbc/kmonitor</non-jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
    </properties>
    </persistence-unit>
    </persistence>
    We use KMonitor in glassfish, stand-alone unit is not used and ignore it.
    Thanks!

    Hi I discovered problem. Top link doesnt have correct message for this problem!
    My entity had this annotation:
    @Entity
    @Table(name = "fontestatus", catalog = "databasename", schema = "")
    But catalog doesn´t exist in test enviroment, only development! solution is delete this:
    @Entity
    @Table(name = "fontestatus")

  • Using a VARCHAR2 in a SELECT command

    I'm trying to query for a given path in a hierarchy of products. However, I want to be able to have it return multiple values. So, I created a string in my function below that returns identifiers like "(34, 43, 54)" to be used in a SELECT IN. The function works fine, but the select command fails. How can I get the SELECT to work?
    CREATE TABLE PRODUCT (
      PRODID NUMBER,
      PARENTID NUMBER,
      CATID NUMBER,
      ALIAS VARCHAR2(128)
    CREATE OR REPLACE FUNCTION FIND_PRODS_BY_PATH
    (CAT_ID IN NUMBER, IN_PATH IN VARCHAR2) RETURN VARCHAR2 IS
      PROD_IDS VARCHAR2(1024);
    BEGIN
      PROD_IDS := '(';
      FOR PROD IN (SELECT PRODID, SYS_CONNECT_BY_PATH(ALIAS, '/') AS PATH FROM PRODUCT
        WHERE CATID=CAT_ID CONNECT BY PRIOR PRODID=PARENTID)
      LOOP
        IF REGEXP_LIKE(PROD.PATH, IN_PATH) THEN
          IF LENGTH(PROD_IDS) > 1 THEN
            PROD_IDS := PROD_IDS || ', ';
          END IF;
          PROD_IDS := PROD_IDS || PROD.PRODID;
        END IF;
      END LOOP;
      PROD_IDS := PROD_IDS || ')';
      RETURN PROD_IDS;
    END FIND_PRODS_BY_PATH;
    *** Doesn't like the varchar2 returned from the function ***
    SELECT * FROM PRODUCT WHERE PRODID IN FIND_PROD_BY_PATH(5, '/my/product/path/*');
    Error report:
    SQL Error: ORA-01722: invalid number
    *** Function works ***
    SELECT FIND_PROD_BY_PATH(5, '/my/product/path/*') FROM DUAL;
    FIND_PRODS_BY_PATH(5, '/my/product/path/*')                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
    (301152, 301202, 301252, 301302, 301403)

    Your function is effectively returning a single string, which is not automatically devived into individual tokens for using in the IN clause.
    How to circumvent this is best described here:
    http://www.oracle.com/technology/oramag/oracle/07-mar/o27asktom.html
    (search for "Varying IN Lists")

  • Delete command in SQLPLUS by use wrong column name command

    Assume I have three table T1,T2 and T3 shown as follow...
    sql> desc T1 ;
    cusid number
    name varchar2(50)
    sql> select * from T1;
    cusid name
    1) 101 TEST1
    2) 102 TEST2
    3) 103 TEST3
    4) 104 TEST4
    sql>desc T2;
    ref_cusid number
    sql>select * from T2
    cusid
    1) 103
    if I want to delete account in T1 that deleted account is in T2.
    I must use query1 , it will work
    query1::>
    delete from T1 where cusid in (select ref_cusid from T2);
    but if i type wrong by this command
    query2::>
    delete from T1 where cusid in (select cusid from T2);
    in query 2,it should be have warning message because field cusid is not in T2.Right ? But it will delete all account in table T1.
    compare query2 with query 3,
    query3::>
    delete from T1 where cusid in (select field_test from T2);
    it will show warning message like 'ORA-00904: "FIELD_TEST": invalid identifier'
    I noticed that in query2 and query3 , Different Thing is query 2 wrong column name in T2 has same name as column in T1. I wonder why it is.

    I doubt very much if this is really what you did:
    sql>desc T2;
    ref_cusid number
    sql>select * from T2
    cusid
    1) 103The desc command shows a column name ref_cusid. The select command shows a column title cusid, not ref_cusid.
    You start by saying that you have 3 tables, without doing anything with T3. Are you sure you you haven't mixed up a copy and paste somewhere?

  • Problem with MySQL - WLS61:General error: select command denied to user: 'foo@lion.e-pmsi.fr' for table 'finess'

    Hi
    I've been trying to adapt and deploy an enterprise appliaction developped and deployed
    before under JBoss.
    My database is MySQL and I use Together Control Center for development and hot deployment.
    After having modified a lot of things (the seamless protability seems always sor
    far :), now I get some strange error when deploying from withing Together Control
    Center 6.0:
    WLS61:General error: select command denied to user: '[email protected]' for table
    'finess'
    Off course the user foo has all possible and imaginable rights.
    Does anybody have an idea on how to get around it ?
    Thanks
    Alireza

    Found the answer... email that went to junk mail. Hope this helps others!
    Hello Subscription User,
     Thanks for choosing ClearDB for your database needs. We appreciate your business and 
     your interest in our services. Our commitment to all of our customers is that we 
     provide a high quality of service on all of our database systems. Part of that 
     commitment includes the enforcement of database size quotas in order to ensure 
     the highest quality of service for our customers.
     As such, we're sending you this automated message regarding one of your databases:
     Database: wp____
     Tier/Plan: Mercury
     Tier size quota: 20 MB
     This database has either reached or has exceeded its maximum allowed size for the 
     'Mercury' plan/tier that it currently belongs to. As such, our systems were forced to 
     place a read-only lock on it. We kindly encourage you to upgrade your database 
     to a larger tier/plan so that we can restore write privileges and enable complete 
     access to it from your account.
     If you feel that you have received this notification in error, please feel free 
     to contact us by replying to this email along with information that you feel may 
     assist us in assessing the situation with your database.
     Thanks again for choosing ClearDB,
     The ClearDB Team

  • Cannot change SELECT command Datalist

    Hi , 
    I have a datalist with a selectedcommand , but i want to change it at runtime ( i have a dropdownlist and want to search based upon the values of dropdownlist) , I used this in button click event:
    if (DropDownList1.Text=="blabla")
                this.SqlDataSource1.SelectCommand = "SELECT prodID,[Prodname], [Price], [ProdCode], [Weights], [Size], [Photo] FROM [Products] where Cat='ct1' and Price<10000 ";
                this.SqlDataSource1.DataBind();
                DataList1.DataBind();
    but  nothing happens. I also tried http://social.msdn.microsoft.com/Forums/sqlserver/en-US/b1d4a3a5-7ba3-4383-a52a-fd472f1aad11/change-sqldatasource-select-command-at-runtime?forum=Offtopic 
    but it doesn't work for me . any ideas ?

    Hi,
    Try the below code.
    if (DropDownList1.Text == "blabla")
    SqlDataSource SqlDataSource1 = new SqlDataSource();
    SqlDataSource1.SelectCommand = "SELECT prodID, [Prodname], [Price], [ProdCode], [Weights], [Size], [Photo] FROM [Products] where Cat='@cat' and Price < @price";
    SqlDataSource1.SelectParameters.Clear();
    SqlDataSource1.SelectParameters.Add("cat", TypeCode.Int32, "1");
    SqlDataSource1.SelectParameters.Add("price", TypeCode.Decimal, "1");
    //your connection string from web.config
    SqlDataSource1.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectString"].ConnectionString;
    DataList1.DataSource = SqlDataSource1;
    DataList1.DataBind();
    SRIRAM

  • SQL: combined SELECT-command possible???

    Hello Experts!
    in the enclosed SQL-command I'm actually selecting from table EKPO only the open POs with no reference in order-history (EKBE). Now I want to enlarge/combine this command in that way that additionally records from order history (EKBE) with a special movement type in EKBE are selected on top.
    Is it possible or do need a second select-command in the Z-application???
    THANKS for a response.
    Regards,
    Bernd
    select ebeln ebelp menge meins txz01 bukrs matkl
             werks matnr mtart labnr elikz pstyp from ekpo as b
        into (itab-bestnr, itab-pos, itab-best_mng,itab-meins, itab-text,
             itab-bukrs, itab-matkl, itab-werks, itab-matnr, itab-mtart,
             itab-labnr, itab-elikz, itab-pstyp)
        where ( mtart = 'ETMW' or mtart = 'ETVB' ) and
              menge > 0 and
              loekz <> 'L' and
              loekz <> 'S' and
              elikz <> 'X' and  " Endliefer-KZ
              ebelp not in ( select ebelp from ekbe where
                                    ebeln = b~ebeln ).
    Edited by: Bernd Thielemann on Jul 21, 2008 4:37 PM

    The result should be all open orders!
    1.) no EKBE
    2.) EKBE but quantity of goods receipt (WE) is less than quantity of the PO
    3.) intercompany-POs (stock transport order) have other movement types (like LFS and WA) which do not effect the status of the open PO until good-receipt movement is posted in the receiving plant .
    First/Second condition is realized. Third condition is the gap until now.
    Regards,
    Bernd

  • Problem on select command for table AFKO-GSTRS,AFKO-GSUZS

    Hi all Abaper,
    I faced a problem on using select command to select out the records from table AFKO (Production order header)
    If i want to select out records that
    AFKO-GSTRS >= 14.4.2006 (schedule start date)
    AFKO-GSUZS >= 00:00:00 (schedule start time)
    AFKO-GSTRS <= 15.4.2006 (schedule start date)
    AFKO-GSUZS <= 00:00:00 (schedule start time)
    The select statement:
    SELECT AUFNR RSNUM DISPO GSTRS GSUZS
            INTO TABLE GT_AFKO FROM AFKO
                    WHERE
           ( GSTRS >= GV_ST_DATE AND GSUZS >= GV_ST_TIME )
       AND ( GSTRS <= P_DATE AND GSUZS <= P_TIME ).
    PS.  if GV_ST_DATE = 14.4.06,  GV_ST_TIME = '00:00:00'
            P_DATE AND = 15.4.06,      P_TIME = '00:00:00'
    This statement just select out records in
    between 14-15.4.06 and at time '00:00:00'.
    some Production orders at 14.04.06 ,'09:00:00' will be filter out.
    I know the problem on that system just consider the date and time separately.
    Does anyone know how to link the date and time up? or does any data type allow for combination of date and time data?
    Thx for your reply in advance~

    Thx Amit and Vijay.
    The data type for GV_ST_DATE, P_DATE are <b>SY-datum</b>
    and GV_ST_TIME, P_TIME  are <b>SY-UZEIT</b>
    Actually, P_DATE & P_TIME are user input parameters.
    The records I wanna get are the period back 24 hrs from P_DATE & P_TIME.
    For example, if user input P_DATE = 15.04.2006,
                               P_TIME = '10:00:00'.
    Then records selected out should be:
    from 14.04.2006 , '10:00:00' TO 15.04.2006, '10:00:00'
    if production order schedule start = <b>14.04.2006 , 09:00:00</b>
    it will be <b>included</b>.
    if production order schedule start = <b>15.04.2006 , 01:00:00</b>
    it will be <b>excluded</b>.
    However, the following statement cannot get the desired records.
    Select....
    where GSTRS >= GV_ST_DATE AND GSUZS >= GV_ST_TIME
    AND   GSTRS <= P_DATE AND GSUZS <= P_TIME.
    Since GV_ST_TIME & P_TIME are both = '00:00:00',
    for Production order( sch start date = 14.04.2006 , sch start time = 09:00:00 ), '09:00:00' is greater than '00:00:00' but it is not less than '00:00:00'.
    Thus, this Pro. Order will be filtered!!
    However can improve my SQL statement to get the desired data?

  • Long select command

    hey, I have a real long select command and it goes down to the next row of my sql*plus. when i try to perform it it says the from statement is in the wrong spot but its just getting confused. how do i fix this?

    Just manually edit the query and add adequate line feeds. That would make the query readable too.

  • SELECT Command on Associative Array

    Guys,
    I have a question on associative arrays in ORACLE.
    I m working on one assignment where I am not allowed to create any object into the database e.g. Create temporary tables, use of cursors etc.
    For data manipulation i used associative array, but at the end i want to show that result in pl/SQL developer.
    I know that I can't use select command on associative arrays.
    Any alternative/solution for it?
    Also is there any way that i can write the contents of associative array to a .csv file?

    user13478417 wrote:
    I m working on one assignment where I am not allowed to create any object into the database e.g. Create temporary tables, use of cursors etc.Then cease to use Oracle - immediately. As you are violating your assignment constraints.
    ALL SQL and anonymous PL/SQL code blocks you send to Oracle are parsed as cursors. And as you are not allowed to use cursors, it will be impossible to use Oracle as cursors is exactly what Oracle creates... and creates a lot of. For every single SQL statement. And every single anonymous PL./SQL block.
    For data manipulation i used associative array, Why? Arrays is a poor choice in Oracle as a data structure most times as it is inferior in almost every single way to using a SQL table structure instead.
    Pumping data into an array? That already severely limits scalability as the array requires expensive dedicated server (PGA) memory. It does not use the more scalable shared server (SGA) memory.
    Manipulating data in an array? That requires a "+full structure scan+" each time as it does not have the indexing and partitioning features of a SQL table.
    Running a SQL select on an array? That is using a cursor. That also means copying the entire array structure, as bind variable, from the PL/SQL engine to the SQL engine. An excellent way to waste memory resources and slow down performance... but hey you can still shout "+Look Ma, no --brains-- hands, I'm not using any SQL tables as dictated by my assignment!+".... +<sigh>+
    Any alternative/solution for it?You mean besides using Oracle correctly ?
    You could reload the shotgun and shoot yourself in the other foot too. That should distract you for from the pain in the first foot.

  • Select command handling

    hey guys i am handling Selec command.i ahve a doubt as to how can a select command which comes as case 2 be handled in t=0 and t=1 protocol.
    the command is 00 a4 04 00 00

    CDTPCAPI wrote:
    ok let take the scenario:
    1.usual case:
    when a select command is issued with p3=08 (00a40400081122334455667788)and followed by 8 bytes aid,the select handler will search card registry for a partial/full match for the given aid in the apdu buffer.
    2.Now if select command comes with P3=00(00a4040000),it signifies that isd must be selectd and its responce data must be sent to the terminal.
    As per the the defin of select command, a select command is always followed by an aid and p3 is considered Lc for the command.But when select comes with p3=00 (00a4040000) the Lc and data field of the command must be ignore,Le should be set to 00 and it shu now be handled as a case 2 command.
    Now for a case 2 command(emv std) whever the le field is 00, an errro status of 6cxx must be sent so that the previous command header is repeated with le set to xx.6Cxx is a warning condition, not an error.
    So in above discussu lets say Isd selection generated 12hex bytes of data and the termianl issues 00a4040000.So folowin the protocol,6c12 will be sent out.the termianl willnow repeat select command as 00a4040012.
    So now while procesing,there is no way to find out that the select command was previous a case 2 commmandYou're correct in your finding that JC and EMV specs clash at this point. Thats why VGP describes the above situation and mandates EMV compliance, thus violating JC. I cannot paste you the content (as VGP is not an open specification), but you can get an idea when looking into GP 2.1.1: A.2 GlobalPlatform on a Java Card, T=0 Transmission Protocol:
    T=0 Transmission Protocol
    GlobalPlatform cards are intended to be functional in the widest range of environments (i.e. Card Acceptance
    Devices). Currently the Java Card™ 2.1.1 Runtime Environment (JCRE) Specifications and the Java Card™ 2.2
    Runtime Environment (JCRE) Specifications describe the behavior for case 2 commands (when using the T=0
    protocol) in contradiction to EMV 2000. GlobalPlatform mandates that the JCRE shall handle this case of
    command in accordance with ISO/IEC 7816: An applet receiving a case 2 command builds the response and
    invokes the appropriate API to output the data. If the data is less than the data expected by the terminal, the
    OPEN will store the data and output a 6Cxx response code and wait for the CAD to re-issue the command with
    the correct length. When the re-issued command is received the JCRE will manage the outputting of the stored
    data.As you seem to be working on a smart card OS, you will have control over the communication layer.

  • Select Command Le check. Can't get the Le.

    Hello all.
    I have a question.
    I am making an applet.
    Into the Select command, I think my applet cannot get the Le data.
    The Le value has always '00' even though the select command Le value has been changed.
    First, in order to get the Le, I used the apdu.setOutgoing(), which returns Le, and then I checked the Le != 0.
    However, I think the setOutgoing() always returns '00' in my applet, and the applet does not perform the checking Le statement.
    I guess my testing environment or performing follow has a problem, but I am not sure.
    I want to hear your opinion and how to test in this case.
              short idl = apdu.setIncomingAndReceive();
              byte[] apduBuffer = apdu.getBuffer();
              short le = (short)(apdu.setOutgoing() & (short)0x00ff);
              if(apduBuffer[ISO7816.OFFSET_CLA] != CLASS_ISO)
         CardException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);
              Util.arrayCopy(fileControlInformation, (short)0, transientData, TD_OFF_FILE_CONTROL_INFORMATION, (short)fileControlInformation.length);
              if((apduBuffer[ISO7816.OFFSET_P1]!=(byte)4) || ((apduBuffer[ISO7816.OFFSET_P2]!=(byte)0)))
         CardException.throwIt(ISO7816.SW_INCORRECT_P1P2);
              if((apduBuffer[ISO7816.OFFSET_LC] == (byte)0) || (idl == (short)0) || (apduBuffer[ISO7816.OFFSET_LC] != (byte)idl) || (le != (short)0))
                        CardException.throwIt(ISO7816.SW_WRONG_LENGTH);
    For example,
    00A4040007xxxxxxxxxxxxxx01<<9000
    Although wrong Le is added, the applet returns 9000.
    I know why the applet returns 9000.
    The point is how to test it correctly.
    Thank you.
    글 수정: Jin

    not really, "select application" can return whatever you like, and most applets do return something: a file control information template (fci) giving the AID and other info (for an example, try to select a card manager). That's a good practice: because you can select an application with only part of an AID, the applet usually replies with this complete AID. [tell the card: "Hello ath", she will respond "Hello, understood, but if you want to know, my full name is Athena" :) ]
    Jin, can you post your whole process() algorithm for the select command, including: how are you returning data? do you use apdu.SendBytes() ?
    if you have a contactless card it is possible that Le is always zero, because according to iso7816 zero means "all available data".
    why? because a contactless card (or a T=1 card) can return any length without prior indication, so it does not need Le.
    or it might be a bug in your javacard implementation...
    You can use apdu.SetOutgoingLength() to indicate the real length of the response, and usually the card OS (below javacard) relies on that to create a 6CXX response if there's a problem.
    A workaround can be: Read Le in the apdu buffer at the correct offset, and send a 6CXX SW yourself if you're not satisfied with it.
    I'm expecting more details from you to fully understand the problem.

Maybe you are looking for