Select command on oracle 8i

I have problem that how select a list of maximum 10 element that have highest value.
Example:
my table has 2 columns: name , price
I need to extract list of 10 item that have highest value
Please help

You can do:
SELECT *
FROM (SELECT name, Max(Price) -- to get the max price
FROM Items
GROUP BY name -- the column "item" is in the select
-- that's why it's put in GROUP BY
ORDER BY 2 DESC) -- Order by Maximum to Minimum
WHERE ROWNUM <= 10 -- ROWNUM is a virtual column, that count
-- the return records. So, only it musts
-- to get records when rownum has values
-- between 1 to 10.

Similar Messages

  • 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")

  • Re: the similar decode sql command (in Oracle) in ABAP

    Dear ABAP Expert,
    Could you let me know where there is a similar decode command in Oracle in ABAP?
    Thanks.
    Arthur

    Hi,
    You can specify case statement between SELECT and ENDSELECT. However this may lead to performance problems. Please take care.
    Example:-
    SELECT FIELD1 into LOC_FIELD FROM TAB.
      CASE LOC_FIELD.
        WHEN 'ABC'.
          WRITE: 'ABC'.
        WHEN OTHERS.
          WRITE: 'REST'.
      ENDCASE.
    ENDSELECT.
    Thanks and Best Regards,
    Dinesh.

  • 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")

  • 0% idle time of cpu states from top command in oracle 8i /solaris 5.9

    Hi,
    for long time idle time is 0% in top command :
    database version:oracle 8.1.7.4.0
    operating system : sun solaris 5.9
    load averages: 9.32, 5.78, 6.13 15:22:13
    404 processes: 387 sleeping, 13 running, 4 on cpu
    CPU states: 0.0% idle, 78.2% user, 21.8% kernel, 0.0% iowait, 0.0% swap
    Memory: 16G real, 7535M free, 5842M swap in use, 9965M swap free
    PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND
    6928 oracle 11 20 0 0K 0K run 2:20 12.62% oracle
    23518 oracle 21 31 0 0K 0K run 24:37 11.69% oracle
    9664 oracle 20 30 0 0K 0K run 12:41 10.83% oracle
    15764 oracle 12 21 0 0K 0K run 2:18 10.28% oracle
    9214 oracle 19 21 0 0K 0K run 5:52 8.58% oracle
    13734 oracle 173 21 0 0K 0K cpu/3 311:23 6.11% oracle
    19271 oracle 1 59 0 0K 0K cpu/0 726:20 4.45% oracle
    10436 oracle 1 59 0 0K 0K sleep 81:41 4.39% oracle
    22400 oracle 11 59 0 0K 0K sleep 3:22 4.35% oracle
    9297 oracle 20 59 0 0K 0K cpu/2 7:39 3.66% oracle
    22175 oracle 19 59 0 0K 0K sleep 6:55 3.41% oracle
    9494 oracle 1 30 0 0K 0K run 0:02 2.99% oracle
    10719 oracle 1 59 0 0K 0K sleep 132:48 1.55% oracle
    210 oracle 1 59 0 0K 0K sleep 86:56 1.04% oracle
    22084 oracle 24 59 0 0K 0K sleep 2:50 0.92% oracle
    and sometime load average goes to 25-30 and cpu states is 0% idle in that load so how i can tune my database:
    Regards
    Prakash

    Hi,
    here 0% idle, 0% iowait
    one of the query explain plan i am posting over here:
    Operation     Object Name     Rows     Bytes     Cost     TQ     In/Out     PStart     PStop
    SELECT STATEMENT Hint=CHOOSE          77 K          11800                     
    COUNT STOPKEY                                        
    VIEW          77 K     32 M     11800                     
    SORT UNIQUE STOPKEY          77 K     10 M     8384                     
    HASH JOIN OUTER          77 K     10 M     4968                     
    HASH JOIN          77 K     9 M     4477                     
    HASH JOIN          54 K     2 M     3071                     
    TABLE ACCESS FULL     GA_INSTANCE     10      140      1                     
    HASH JOIN          75 K     2 M     3069                     
    HASH JOIN          75 K     1 M     2351                     
    INDEX FAST FULL SCAN     CUST_ACCT_ADDR_PK     75 K     960 K     282                     
    TABLE ACCESS FULL     ADDRESS     199 K     1 M     1960                     
    TABLE ACCESS FULL     CUST_ACCT     112 K     1 M     593                     
    TABLE ACCESS FULL     IQARA_CNR_ACT_LOG     89 K     6 M     1150                     
    TABLE ACCESS FULL     NI_STATIC_IP_ADDR     21 K     317 K     60                     
    Reagrds
    Prakash

  • What is audit command in oracle

    Hi all,
    what is audit command in oracle ,How can we use it .
    Kindly help me.
    thank you .
    Regards,
    P Prakash

    commands From the link : http://www.dba-oracle.com/t_audit_table_command.htm given below
    --Audit all Oracle user activity. 
    --This audits everything including DDL (create table), DML (inserts, updates, deletes) and login/logoff events:
         audit all by FRED by access;
    --Audit all Oracle user viewing activity:
       audit select table by FRED by access;
    --Audit all Oracle user data change activity:
       audit update table, delete table,
          insert table by FRED by access;
    --Audit all Oracle user viewing activity:
       audit execute procedure by FRED by access;

  • RMAN command in  Oracle VSS Writer for  incremental/differential restore

    Hello
    Working on application to support incermental/differential backup via VSS ( Oracle VSS Writer )
    Accoding to documentation about [Performing Database Backup and Recovery with VSS  |http://docs.oracle.com/cd/E11882_01/win.112/e10845/vss.htm]
    Oracle VSS Writer does not perform default recovery of Archived redo log or flash recovery component. (This component is defined to contain only log or incremental files)
    Nevertheless, the requestor application can invoke required RMAN commands.
    What RMAN command is needed to be performed for incermental logs recovery? (This command is set in VssBackupComponents::SetRestoreOptions call and will be performed on PostRertore Phase by Writer)
    I have tried RESTORE ARCHIVELOG ALL but did not succeeded .
    Thanks

    Let we describe my oracle VSS backup/restore proccess in details
    Succeeded with full backup/restore only, but failed to to implement differential one.
    Oracle VSS Writer support only three components for explicit selection for backup: Oracle Database and it sub-component: Flash Recovery Area/ArchivedLogs.
    For full backup stage I explicitly select these components
    Why not only Oracle database as ancestor of Flash Recovery Area/ArchivedLogs?
    As oracle vss writer uses time stamp mechanism for incremental and differential backups,
    I select all these components for full backup stage (to get previous timestamps for Flash Recovery Area/ArchivedLogs on differential backup phase. With explicit selection these components its timestamps will be added to backup component document. )
    On diferential backup phase I select Flash Recovery Area/ArchivedLogs only using previous backup stamp(SetPreviousBackupStamp call), loaded from previous backup component document.
    Restore perform sequentially:
    1. Restore data from full backup phase (select all these three components for Restore), but do SetAdditionalRestore(true) for OracleDatabase component to avoid bringing Oracle database only after full restore phase
    2. Restore data from differential phase (select Flash Recovery Area/ArchivedLogs for Restore only( even can't select Database as there is no record in backup component document about it on differential phase backup) and call SetAdditionalRestore(false) for these components
    As Oracle Writer does not perform default recovery of this component. Nevertheless, the requester application can run required RMAN commands(via setRestoreOptions VSS call). I tried as RECOVER DATABASE as RESTORE ARCHIVELOG ALL commands , but failed to restore database.
    If I restore full backup phase(without differential) only and call SetAdditionalRestore(false) for Oracle Database component, Oracle VSS writer restores data successfully and mount database.
    How to restore differential part?

  • Searchadmin command in Oracle SES

    Hi Can anyone tell me from where can i execute searchadmin command in oracle ses, and  in the link followed Administration Object Types what is /scratch/skins referring to ? Please help its very urgent

    Hi Raford,
    Thanks for your reply.
    I could see all the Metadata attibutes in the advance search option. But instead is there any option like.. first i should select the Category and after that i should select my desired Metadata Attributes in that category.
    We need this feature because a customer might find difficult to select his desired MetaData Attribute from the entire list of MetaData Attributes LOV
    Thanks
    parker.

  • How do I write this SQL command in Oracle

    Hi all
    I wriote this SQ L statement in Ms SQL Server. How do I write this sql command in Oracle?
    ALTER VIEW dbo.ConsumptionAS SELECT TOP 100 PERCENT ID,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200710' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Oct2007,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200711' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Nov2007,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200712' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Dec2007,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200801' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jan2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200802' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Feb2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200803' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Mar2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200804' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Apr2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200805' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS May2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200806' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jun2008 ,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200807' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jul2008 ,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200808' AND NbrDaysUsed != 0 THEN (QtyUsed/ NbrDaysUsed) * 748.05 ELSE 0 END)) AS Aug2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200809' AND NbrDaysUsed != 0 THEN (QtyUsed NbrDaysUsed) * 748.05 ELSE 0 END)) AS Sep2008
    FROM dbo.MasterConsumption WHERE YEAR_MONTH >= '200710' AND YEAR_MONTH <= '200809' GROUP BY ID ORDER BY ID
    I am very interested in this part:
    SUM(CASE WHEN YEAR_MONTH = '200710' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Oct2007
    thanks
    Edited by: user631364 on Oct 27, 2008 8:25 AM
    Edited by: user631364 on Oct 27, 2008 8:26 AM
    Edited by: user631364 on Oct 27, 2008 8:27 AM

    Thank you!!
    Now let me aslk the second part of my question.
    This sql command:
    ALTER VIEW dbo.ConsumptionAS SELECT TOP 100 PERCENT ID,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200710' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Oct2007,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200711' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Nov2007,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200712' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Dec2007,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200801' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jan2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200802' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Feb2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200803' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Mar2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200804' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Apr2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200805' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS May2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200806' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jun2008 ,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200807' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jul2008 ,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200808' AND NbrDaysUsed != 0 THEN (QtyUsed/ NbrDaysUsed) * 748.05 ELSE 0 END)) AS Aug2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200809' AND NbrDaysUsed != 0 THEN (QtyUsed NbrDaysUsed) * 748.05 ELSE 0 END)) AS Sep2008
    FROM dbo.MasterConsumption WHERE YEAR_MONTH >= '200710' AND YEAR_MONTH <= '200809' GROUP BY ID ORDER BY ID
    was created with this query in SQL Server and then I saved it in a store procedure, that I scheduled to run montlhy
    SET ANSI_NULLS ON
    DECLARE @SQLString NVARCHAR(4000)
    /* Build the SQL string once.*/
    SET @SQLString = 'ALTER VIEW dbo.Consumption AS SELECT TOP 100 PERCENT ID, CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = ' +
    "'" + dbo.CONLastMonth_fn(getdate(), month(getdate()) - 12) +
    "'" +
    ' AND NbrDaysUsed != 0 THEN (QtyUsed/ NbrDaysUsed) * 748.05 ELSE 0 END)) AS ' +
    dbo.CONMonthInEnglish(getdate(), month(getdate()) - 12) +
    … (GOES FROM current month -12 to current month -1)
    , CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = ' +
    "'" + dbo.CONLastMonth_fn(getdate(), month(getdate()) - 1) +"'" +
    ' AND NbrDaysUsed != 0 THEN (QtyUsed/ NbrDaysUsed) * 748.05 ELSE 0 END)) AS ' +
    dbo.CONMonthInEnglish(getdate(), month(getdate()) - 1) +
    ' FROM dbo.MasterConsumption WHERE YEAR_MONTH >= ' +
    "'" + dbo.CONLastMonth_fn (getdate(), month(getdate())-12 ) +"'" +
    ' AND YEAR_MONTH <= ' +
    "'" + dbo.CONLastMonth_fn (getdate(), month(getdate())-1 ) +"'" +
    ' GROUP BY ID ORDER BY ID '
    EXEC sp_executesql @SQLString
    Is that something that can be done in Oracle in the same way?
    Do you use another approach?
    please advice
    Edited by: user631364 on Oct 27, 2008 10:19 AM
    Edited by: user631364 on Oct 27, 2008 10:21 AM
    Edited by: user631364 on Oct 27, 2008 10:21 AM
    Edited by: user631364 on Oct 27, 2008 10:22 AM
    Edited by: user631364 on Oct 27, 2008 10:23 AM
    Edited by: user631364 on Oct 27, 2008 10:23 AM
    Edited by: user631364 on Oct 27, 2008 10:24 AM

  • 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 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).

  • "Ping" command to Oracle server?

    Hi to all, I am using a connection pool to improve my application, and I am interested in checking the connections in the pool when they are to be used. I tried to use the method Connection.isClosed(), but this method returns false, even if I shutdown the DB (it seems not realize the shutting down state). So, it is not usefull. A connection pool implementation in JDC suggets to use getMetaData(), but it doesn't work because an SQLException is not thrown, even when the server is down. So, I am currently using:
    try{
    Statement dummyStmt = conn.createStatement();
    dummyStmt.close();
    }catch(SQLException e){
    The question is: Because this code will be executed each time a Connection is requested, I need it to be low cost and quick. Is this the best way to do it, or can I send a kind of "ping" command to Oracle?
    Thank you all in advance.

    >
    try{
    Statement dummyStmt = conn.createStatement();
    dummyStmt.close();
    }catch(SQLException e){
    The question is: Because this code will be executed
    each time a Connection is requested, I need it to be
    low cost and quick. Is this the best way to do it, or
    can I send a kind of "ping" command to Oracle?
    Actually I wouldn't think that would be sufficient since it doesn't need to actually send anything to the server to do that.
    I usually suggest sending "select 1 from dual".
    You might want to also consider doing in more often than just when a connection is requested. Oracle will time out connections. One of the points of a pool is to not to require the setup cost each time. To keep a connection active it has to do something periodically. The connection pool should do that (the above query can be what it does.)

  • How can I use unix commands from oracle report

    I have to use the following command from oracle reports.
    In oracle forms we can use the HOST command but what about oracle reports2.5.
    I have to email the attached file 100245.pdf from oracle reports to the given email id
    uuencode 100245.pdf 100245.pdf | mailx -s "test" [email protected]

    Hi,
    It's because .bat (or .cmd) files are scripts and not executables and are interpreted using the command line executable - which is normally cmd.exe (although you can buy others).
    So you need to call cmd.exe passing the bat file name as a parameter, something like
    cmd.exe /c batchfilename
    Without the /c you will never get a response.
    However, this brings us to the bizarre conclusion that you are going to:
    call cmd.exe (a shell interpreter)
    to launch a batch file
    that calls cygwin (another shell interpreter)
    which then runs ls
    When shouldn't that just be:
    call cmd.exe to run the dir command
    Or better yet, If you are just after a file name listing and you seem to understand Java stored procs, why not just write a JSP to list the contents of a directory? No problems with OS dependant commands, scripts and 3rd party interpreters. Plenty of examples of that out on the internet as well.
    HTH
    Chris

  • How can I use custom WLST commands for Oracle SOA Suite in Weblogic

    Hi There,
    I'm trying to view and search the weblogic log files using WLST on a Solaris/Unix system.
    I have come across this "custom WLST commands for Oracle SOA Suite" and thought of using the custom logging commands to get my task done.
    However, my WLST shell is not recognizing the commands and giving me the NameError!
    wls:/devDomain1/domainRuntime> listLogs()
    Traceback (innermost last):
    File "<console>", line 1, in ?
    NameError: listLogs
    I tried the commands listLogs, displayLogs, getLogLevel & setLogLevel but in vain!
    I have followed the instructions as per the oracle recommendation of using Custom WLST commands (http://docs.oracle.com/cd/E29597_01/core.1111/e10105/getstart.htm#ASADM10692) as below
    - Launched the WLST shell from Oracle Home.
    cd ORACLE_HOME/common/bin
    ./wlst.sh
    - Tried to run the listLogs command from domainRuntime()
    I would like to know if I need to import any additional libraries to run the custom WLST commands for Oracle SOA Suite in my WLST shell?
    I have only weblogic 10.3.1 server installed on my Solaris 10 machine on which I have deployed the OSB application software.
    There is no SOA Suite installed.
    Or is there any other way I can browse the Server Log file and get the list of log messages? Basically I would like to use this feature in my script to customize it according to my requirement of listing specific error logs which I can work it out if I know how to make these commands work.
    Please advise if this is possible and how?
    Cheers.
    Satish

    I have tried on my OSB installation (no SOA Suite here), the command listLogs() works (I was in online mode, after a connect), and the classpath is:
    CLASSPATH=/opt/oracle/fmw11_1_1_5/patch_wls1035/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/opt/oracle/fw11_1_1_5/patch_ocp360/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/usr/lib/jvm/java-1.6.0-sun-1.6.0.33.x6_64/lib/tools.jar:/opt/oracle/fmw11_1_1_5/wlserver_10.3/server/lib/weblogic_sp.jar:/opt/oracle/fmw11_1_1_5/wlserver_10./server/lib/weblogic.jar:/opt/oracle/fmw11_1_1_5/modules/features/weblogic.server.modules_10.3.5.0.jar:/opt/oracle/fmw111_1_5/wlserver_10.3/server/lib/webservices.jar:/opt/oracle/fmw11_1_1_5/modules/org.apache.ant_1.7.1/lib/ant-all.jar:/optoracle/fmw11_1_1_5/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar::/opt/oracle/fmw11_1_1_5/oracle_common/moules/oracle.jrf_11.1.1/jrf-wlstman.jar:/opt/oracle/fmw11_1_1_5/oracle_common/common/wlst/lib/adfscripting.jar:/opt/oracl/fmw11_1_1_5/oracle_common/common/wlst/lib/adf-share-mbeans-wlst.jar:/opt/oracle/fmw11_1_1_5/oracle_common/common/wlst/lb/mdswlst.jar:/opt/oracle/fmw11_1_1_5/oracle_common/common/wlst/resources/auditwlst.jar:/opt/oracle/fmw11_1_1_5/oracle_cmmon/common/wlst/resources/igfwlsthelp.jar:/opt/oracle/fmw11_1_1_5/oracle_common/common/wlst/resources/jps-wlst.jar:/optoracle/fmw11_1_1_5/oracle_common/common/wlst/resources/jrf-wlst.jar:/opt/oracle/fmw11_1_1_5/oracle_common/common/wlst/reources/oamap_help.jar:/opt/oracle/fmw11_1_1_5/oracle_common/common/wlst/resources/oamAuthnProvider.jar:/opt/oracle/fmw111_1_5/oracle_common/common/wlst/resources/ossoiap_help.jar:/opt/oracle/fmw11_1_1_5/oracle_common/common/wlst/resources/osoiap.jar:/opt/oracle/fmw11_1_1_5/oracle_common/common/wlst/resources/ovdwlsthelp.jar:/opt/oracle/fmw11_1_1_5/oracle_comon/common/wlst/resources/sslconfigwlst.jar:/opt/oracle/fmw11_1_1_5/oracle_common/common/wlst/resources/wsm-wlst.jar:/optoracle/fmw11_1_1_5/utils/config/10.3/config-launch.jar::/opt/oracle/fmw11_1_1_5/wlserver_10.3/common/derby/lib/derbynet.ar:/opt/oracle/fmw11_1_1_5/wlserver_10.3/common/derby/lib/derbyclient.jar:/opt/oracle/fmw11_1_1_5/wlserver_10.3/common/drby/lib/derbytools.jar::
    The wlst.sh I have used is /opt/oracle/fmw11_1_1_5/osb/common/bin/wlst.sh
    I hope this can help

  • SYSTEM HANGS WHILE RUNNING EXP COMMAND IN ORACLE 10G

    WHEN WE ARE RUNNING THE EXP (EXPORT) COMMAND IN ORACLE 10G
    TO TAKE THE BACKUP IT GETS HANGED FOR A LONG TIME AND THEN IN THE LOG FILE WE FIND THE FOLLOWING ERROR MESSAGE.
    SOMETIMES AFTER RESTARTING THE SERVER WE ARE ABLE TO RUN THE EXP COMMAND.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
    About to export specified users ...
    . exporting pre-schema procedural objects and actions
    . exporting foreign function library names for user MANHAR
    . exporting PUBLIC type synonyms
    . exporting private type synonyms
    . exporting object type definitions for user MANHAR
    About to export MANHAR's objects ...
    . exporting database links
    . exporting sequence numbers
    . exporting cluster definitions
    *********************************** AT THIS POINT THE SYSTEM HANGS FOR A LONG TIME.
    EXP-00056: ORACLE error 24324 encountered
    ORA-24324: service handle not initialized
    EXP-00056: ORACLE error 24324 encountered
    ORA-24324: service handle not initialized
    EXP-00000: Export terminated unsuccessfully
    THE EXP COMMAND THAT WE USE IS AS FOLLOWS:
    EXP MANHAR/MANHAR FILE=F:\BACKUP\MANHAR.DMP LOG=F:\BACKUP\MANHAR.LOG BUFFER=1000000 GRANTS=Y CONSTRAINTS=Y
    WE ARE RUNNING THE EXP COMMAND ON THE SERVER ITSELF.
    THE SERVER OPERATING SYSTEM IS WINDOWS 2003 SERVER.
    Kindly give us a solution at the earliest.

    You should ask Oracle support for help. There's only one entry for this error stack (Bug 3361288 - Export of XMLSCHEMA may fail with ORA-24324 in UTF8), but it should have been fixed for your DB version and , as far as I can see, you don't have a Unicode database.
    Werner

Maybe you are looking for

  • Migrate to Windows 2012 R2 and Exchange 2013 SP1 using database portability

    Hi, I'm planning to migrate from Exchange 2013 SP1 running on Windows 2012 to Exchange 2013 SP1 on Windows 2012 R2. Is it possible to use database portability to move the databases from the exchange installation on win 2012 to the new installation on

  • Date format in XML Forms

    Hi all, I already have done my article using XML FORMS. I added into the article the date field that I needed. So, I would like to format the date output in Render List as “dd/mm/yyyy” instead of “mm/dd/yyyy”. It’s possible? Anyone knows how to do it

  • Game performance really bad? Is this a driver issue?

    Hey everyone, well I just installed XP SP2 on my MacBook Pro (early 2008). I tried playing a demo of Empire: Total War and it barely ran on the lowest setting. Is this a driver issue, I'm not sure why it would be though. I updated it completely in wi

  • Web Monitor Reporting Tool

    Dear All, Having read this post :- Data Load Reporting Tool I have come to the conclusion that there isn't any such tool for monitoring of daily loads and the like. Can anyone tell me is it possible to have the underlining tables for RSPCM & RSMON de

  • An example of how far ArchLinux has come

    Congratulations to the developers and packagers at Arch! I want to give a perfect example of how great this system is: My system hasn't been touched for seven months.  I boot the system up, and do two things: 1) #! pacman -Sy pacman 2) #! pacman -Syu