Is oracle can do this

Hi,
i have a view that is doing uinion all with 3 tables.
this view is big and results are about 80 milions rows.
i'm selecting from this view and filtering base on another very small table (only 5 rows)
oracle is not able to filter the rows in the view ( push it down inside the view)
it is doing the hash and building the view and after it doing the filter.
when i change the subquery to hardcoded values then i's doing the pushing .
here is an example :
this is the view
create view z1_abc as
select 'a' tbl,a.* from z1_a a
union all
select 'b' tbl,b.* from z1_b b
union all
select 'c' tbl,c.* from z1_c c
my query :
select * from z1_abc
where id in (select id_f from z1_f)
**** this one not able to filter the values in the view*
second query :
select * from z1_abc
where z1_abc.id in (1,2,3,8)
this query is ok ( ofcourse )
my question :
is it possible to use some dynamic filter but also to benfit from filter inside the view ?
10x
Zvika

10x
i also tried the join and push predicate methods with no success ..
the CBO still doing the union all and after it it filter the subquery or doing the join.
in my real query the union all is more complex with joins in every block of the union all query.
so i want to reduce the join cardinality as much as i can .
here is the explain plan :
join and subquery the same
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 2 | 38 | 9 |
|* 1 | HASH JOIN SEMI | | 2 | 38 | 9 |
| 2 | VIEW | Z1_ABC | 9 | 144 | 6 |
| 3 | UNION-ALL | | | | |
| 4 | TABLE ACCESS FULL| Z1_A | 3 | 9 | 2 |
| 5 | TABLE ACCESS FULL| Z1_B | 3 | 9 | 2 |
| 6 | TABLE ACCESS FULL| Z1_C | 3 | 9 | 2 |
| 7 | TABLE ACCESS FULL | Z1_F | 4 | 12 | 2 |
Predicate Information (identified by operation id):
1 - access("ID"="ID_F")
and when using hard coded values
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 9 | 144 | 6 |
| 1 | VIEW | Z1_ABC | 9 | 144 | 6 |
| 2 | UNION-ALL | | | | |
|* 3 | TABLE ACCESS FULL| Z1_A | 3 | 9 | 2 |
|* 4 | TABLE ACCESS FULL| Z1_B | 3 | 9 | 2 |
|* 5 | TABLE ACCESS FULL| Z1_C | 3 | 9 | 2 |
Predicate Information (identified by operation id):
3 - filter("A"."ID"=1 OR "A"."ID"=2 OR "A"."ID"=3 OR "A"."ID"=8)
4 - filter("B"."ID_B"=1 OR "B"."ID_B"=2 OR "B"."ID_B"=3 OR
"B"."ID_B"=8)
5 - filter("C"."ID_C"=1 OR "C"."ID_C"=2 OR "C"."ID_C"=3 OR
"C"."ID_C"=8)
Zvika

Similar Messages

  • How Oracle can handle this?

    It is on both Prod and Dev server, 10 R2 with BAAN
    Baan application defined the table as
    SQL> desc ttphrs900201
    Name Null? Type
    T$YEAR NOT NULL NUMBER
    T$PERI NOT NULL NUMBER
    T$EMNO NOT NULL CHAR(6)
    T$SERC NOT NULL NUMBER
    T$WGCO NOT NULL CHAR(3)
    T$NHRS$1 NOT NULL NUMBER
    T$NHRS$2 NOT NULL NUMBER
    T$NHRS$3 NOT NULL NUMBER
    T$NHRS$4 NOT NULL NUMBER
    T$NHRS$5 NOT NULL NUMBER
    T$NHRS$6 NOT NULL NUMBER
    T$NHRS$7 NOT NULL NUMBER
    T$CPRJ NOT NULL CHAR(9)
    T$CSPA NOT NULL CHAR(8)
    T$CACT NOT NULL CHAR(8)
    T$CCUN NOT NULL CHAR(8)
    T$CSTL NOT NULL CHAR(4)
    T$CCCO NOT NULL CHAR(8)
    T$INVO NOT NULL NUMBER
    T$DESC NOT NULL CHAR(52)
    T$ISTA NOT NULL NUMBER
    T$IDAT NOT NULL DATE
    T$TRDT NOT NULL DATE
    T$FIEL NOT NULL CHAR(30)
    T$ERMS NOT NULL CHAR(100)
    T$REFCNTD NOT NULL NUMBER
    T$REFCNTU NOT NULL NUMBER
    but when I did this, there are null values for "NOT NULL" column
    SQL> select distinct T$cstl, t$ccco, t$invo, t$ista, t$fiel
    2 from ttphrs900201
    3 where t$year = 2007
    4 and t$emno = '255';
    T$CS T$CCCO T$INVO T$ISTA T$FIEL
    1103 1 2 Proyecto
    1103 1 2
    Is Oracle hidding some values? I am puzzled. Is a way to display the hidden value. BAAN was installed and designed by the contractors year ago.

    Hi,
    blank space values?, what's the result set for
    select nvl2(T$FIEL,'not null','null'), count(*) from ttphrs900201 group by nvl2(T$FIEL,'not null','null');

  • Can I get job after doing Oracle certification at this age?

    Hi
    I am 37 yrs old man from Calcutta,India. I am presently jobless for 3 years now .I am a BSc(PCM) .   I was earlier working as a salesman in a sales based company. I have no experience in IT though I have done lots of IT courses. Can I get job after doing Oracle certification at this age?
    Please advice.
    Regards

    Can I get job after doing Oracle certification at this age?
    Can you get a job if you become certified in Oracle?  Certainly!
    Will you get a job if you become certified in Oracle?  Who knows?
    Professional certifications are not magic wands.  You cannot wave a certificate and cause employers to come running to hire you. Certifications can help you to learn some of the skills required to administer Oracle, or develop in Oracle, or use various Oracle software products. There are companies that need people with this knowledge. I have written a number of articles about the topic:
    Oracle Certification Prep: What is Certification?
    Oracle Certification Prep: Oracle Certified but not Oracle Employed
    Oracle Certification Prep: I know nothing about Oracle... but I want to be a DBA.
    DBA or Developer? Deciding which one suits you best - Certification Magazine
    If you decide to pursue a certification, you can find materials to help you study here:
    Oracle Certification Prep

  • I am new to oracle, plz..anybody can explain this query step by step....plz

    Select distinct(a.esal) from employee1 a where &N = (select count(distinct(b.esal)) from employee1 b where a.esal<=b.esal);
    this is the query to find Nth largest & Nth smallest value from the table employee1....but, i am unable to understand how this query works ....plz..anybody can explain this query step by step with example....plz

    Hi,
    Welcome to the forum!
    The first step in understanding any code is to format it so you can easily see what is a sub-query, what the major clauses of each sub-query are, and things like that.
    For example:
    Select distinct (a.esal)
    from   employee1      a
    where  &N     = (       select  count (distinct (b.esal))
                             from      employee1      b
                    where      a.esal           <= b.esal
                );The only thing I have added to the code you posted was whitespace: newlines, tabs and spaces.
    Now it's easy to see that you're doing a query with a scalar sub-query in the WHERE clause.
    It usually makes sense to read complicated queries from the inside out, that is, start with the deepest nested sub-query.
    In this example, that means:
    select  count (distinct (b.esal))
    from     employee1      b
    where     a.esal           <= b.esalWhat does this query do? Unfortunately, it references something (b.esal) from the super-query, so you can't run it by itself, to see what it does. Let's replace that reference with some hard-coded value, just for now, and run it:
    select  count (distinct (b.esal))
    from     employee1      b
    --where     a.esal           <= b.esal     -- This is the original WHERE clause
    where   a.esal           <= 1000     -- For testing only
    ;Experiment with this for a while, and compare it to the values in the employee1 table (or a small test table that resembles employee1). Try different numbers in place of 1000.
    You'll see that the query is counting how many different salaries are lower than, or equal to, a given salary (1000 in the example above).
    When you understand the sub-query, look at the original query again.
    It is testing to see if exactly &N different esals are lower than or equal to the esal on each row, and displaying that esal if it is. (&N is a substitution variable. If you haven't already defined a value for it, SQL*Plus will ask you for a value when you run the query.)
    In other words, it is finding the N-th lowest value of esal.

  • How I can change this query, so I can display the name and scores in one r

    How I can change this query, so I can add the ID from the table SPRIDEN
    as of now is giving me what I want:
    1,543     A05     24     A01     24     BAC     24     BAE     24     A02     20     BAM     20in one line but I would like to add the id and name that are stored in the table SPRIDEN
    SELECT sortest_pidm,
           max(decode(rn,1,sortest_tesc_code)) tesc_code1,
           max(decode(rn,1,score)) score1,
           max(decode(rn,2,sortest_tesc_code)) tesc_code2,
           max(decode(rn,2,score)) score2,
           max(decode(rn,3,sortest_tesc_code)) tesc_code3,
           max(decode(rn,3,score))  score3,
           max(decode(rn,4,sortest_tesc_code)) tesc_code4,
           max(decode(rn,4,score))  score4,
           max(decode(rn,5,sortest_tesc_code)) tesc_code5,
           max(decode(rn,5,score))  score5,
           max(decode(rn,6,sortest_tesc_code)) tesc_code6,
           max(decode(rn,6,score))  score6        
      FROM (select sortest_pidm,
                   sortest_tesc_code,
                   score,
                  row_number() over (partition by sortest_pidm order by score desc) rn
              FROM (select sortest_pidm,
                           sortest_tesc_code,
                           max(sortest_test_score) score
                      from sortest,SPRIDEN
                      where
                      SPRIDEN_pidm =SORTEST_PIDM
                    AND   sortest_tesc_code in ('A01','BAE','A02','BAM','A05','BAC')
                     and  sortest_pidm is not null 
                    GROUP BY sortest_pidm, sortest_tesc_code))
                    GROUP BY sortest_pidm;
                   

    Hi,
    That depends on whether spriden_pidm is unique, and on what you want for results.
    Whenever you have a problem, post a little sample data (CREATE TABLE and INSERT statements, relevamnt columns only) for all tables, and the results you want from that data.
    If you can illustrate your problem using commonly available tables (such as those in the scott or hr schemas) then you don't have to post any sample data; just post the results you want.
    Either way, explain how you get those results from that data.
    Always say which version of Oracle you're using.
    It looks like you're doing something similiar to the following.
    Using the emp and dept tables in the scott schema, produce one row of output per department showing the highest salary in each job, for a given set of jobs:
    DEPTNO DNAME          LOC           JOB_1   SAL_1 JOB_2   SAL_2 JOB_3   SAL_3
        20 RESEARCH       DALLAS        ANALYST  3000 MANAGER  2975 CLERK    1100
        10 ACCOUNTING     NEW YORK      MANAGER  2450 CLERK    1300
        30 SALES          CHICAGO       MANAGER  2850 CLERK     950On each row, the jobs are listed in order by the highest salary.
    This seems to be analagous to what you're doing. The roles played by sortest_pidm, sortest_tesc_code and sortest_test_score in your sortest table are played by deptno, job and sal in the emp table. The roles played by spriden_pidm, id and name in your spriden table are played by deptno, dname and loc in the dept table.
    It sounds like you already have something like the query below, that produces the correct output, except that it does not include the dname and loc columns from the dept table.
    SELECT    deptno
    ,       MAX (DECODE (rn, 1, job))     AS job_1
    ,       MAX (DECODE (rn, 1, max_sal))     AS sal_1
    ,       MAX (DECODE (rn, 2, job))     AS job_2
    ,       MAX (DECODE (rn, 2, max_sal))     AS sal_2
    ,       MAX (DECODE (rn, 3, job))     AS job_3
    ,       MAX (DECODE (rn, 3, max_sal))     AS sal_3
    FROM       (
               SELECT    deptno
               ,          job
               ,          max_sal
               ,          ROW_NUMBER () OVER ( PARTITION BY  deptno
                                              ORDER BY          max_sal     DESC
                                )         AS rn
               FROM     (
                             SELECT    e.deptno
                       ,           e.job
                       ,           MAX (e.sal)     AS max_sal
                       FROM      scott.emp        e
                       ,           scott.dept   d
                       WHERE     e.deptno        = d.deptno
                       AND           e.job        IN ('ANALYST', 'CLERK', 'MANAGER')
                       GROUP BY  e.deptno
                       ,           e.job
    GROUP BY  deptno
    ;Since dept.deptno is unique, there will only be one dname and one loc for each deptno, so we can change the query by replacing "deptno" with "deptno, dname, loc" throughout the query (except in the join condition, of course):
    SELECT    deptno, dname, loc                    -- Changed
    ,       MAX (DECODE (rn, 1, job))     AS job_1
    ,       MAX (DECODE (rn, 1, max_sal))     AS sal_1
    ,       MAX (DECODE (rn, 2, job))     AS job_2
    ,       MAX (DECODE (rn, 2, max_sal))     AS sal_2
    ,       MAX (DECODE (rn, 3, job))     AS job_3
    ,       MAX (DECODE (rn, 3, max_sal))     AS sal_3
    FROM       (
               SELECT    deptno, dname, loc          -- Changed
               ,          job
               ,          max_sal
               ,          ROW_NUMBER () OVER ( PARTITION BY  deptno      -- , dname, loc     -- Changed
                                              ORDER BY          max_sal      DESC
                                )         AS rn
               FROM     (
                             SELECT    e.deptno, d.dname, d.loc                    -- Changed
                       ,           e.job
                       ,           MAX (e.sal)     AS max_sal
                       FROM      scott.emp        e
                       ,           scott.dept   d
                       WHERE     e.deptno        = d.deptno
                       AND           e.job        IN ('ANALYST', 'CLERK', 'MANAGER')
                       GROUP BY  e.deptno, d.dname, d.loc                    -- Changed
                       ,           e.job
    GROUP BY  deptno, dname, loc                    -- Changed
    ;Actually, you can keep using just deptno in the analytic PARTITION BY clause. It might be a little more efficient to just use deptno, like I did above, but it won't change the results if you use all 3, if there is only 1 danme and 1 loc per deptno.
    By the way, you don't need so many sub-queries. You're using the inner sub-query to compute the MAX, and the outer sub-query to compute rn. Analytic functions are computed after aggregate fucntions, so you can do both in the same sub-query like this:
    SELECT    deptno, dname, loc
    ,       MAX (DECODE (rn, 1, job))     AS job_1
    ,       MAX (DECODE (rn, 1, max_sal))     AS sal_1
    ,       MAX (DECODE (rn, 2, job))     AS job_2
    ,       MAX (DECODE (rn, 2, max_sal))     AS sal_2
    ,       MAX (DECODE (rn, 3, job))     AS job_3
    ,       MAX (DECODE (rn, 3, max_sal))     AS sal_3
    FROM       (
                   SELECT    e.deptno, d.dname, d.loc
              ,       e.job
              ,       MAX (e.sal)     AS max_sal
              ,       ROW_NUMBER () OVER ( PARTITION BY  e.deptno
                                           ORDER BY       MAX (sal)     DESC
                                          )       AS rn
              FROM      scott.emp    e
              ,       scott.dept   d
              WHERE     e.deptno        = d.deptno
              AND       e.job                IN ('ANALYST', 'CLERK', 'MANAGER')
                  GROUP BY  e.deptno, d.dname, d.loc
              ,       e.job
    GROUP BY  deptno, dname, loc
    ;This will work in Oracle 8.1 and up. In Oracle 11, however, it's better to use the SELECT ... PIVOT feature.

  • ORA-28500: connection from ORACLE to a non-Oracle system returned this message: ORA-02063: preceding line from OWB_75

    ORA-28500: connection from ORACLE to a non-Oracle system returned this message: ORA-02063: preceding line from OWB_75
    Scenario:
    I am having difficulty getting ODBC connection between Oracle OWB app with an 11gR2 DB (running on a VirtualBox Linux) and SQL Server 2008 running directly on the host. (Windows 8)
    I am trying to take a SQL Server 2008 feed into Oracle Ware house Builder, and think(!) I have read everything and configured it in accordance (but I presume not given 3 days of failed attempts to fix it). I have also read several blogs, hence there might be a few more settings in the configuration files than the formal documentation says, but these have come from blogs that have “Solved” problems for other similar situations.
    The environments:
    HOST:
    Name: RESOLVEIT-PC
    IP: 192.168.1.80
    Windows 8 (64bit) , with system DSN ODBC connection ACME_POS created with 32 bit ODBC set up (This setting still shows up fine in the 64 bit ODBC).
    GUEST VM:
    Name: OraDBSvr.com
    GUES fixed IP Address: 192.1.200
    Oracle VirtualBox (4.2.16)
    Oracle Redhat Linux 6 (x86)
    Oracle 11gR2 Enterprise Edition (11.2.0.1.0)
    ODBC: Freetds driver
    Configuration files:
    initacmepos.ora
    HS_FDS_CONNECT_INFO = 192.168.1.80/SQLEXPRESS/ACME_POS
    HS_FDS_TRACE_LEVEL = 0
    HS_FDS_SUPPORT_STATISTICS=FALSE
    HS_RPC_FETCH_REBLOCKING= OFF
    HS_FDS_FETCH_ROWS = 1
    HS_FDS_SHAREABLE_NAME = /usr/local/lib/libtdsodbc.so
    set ODBCINI=/opt/odbc/odbc.ini
    # set <envvar>=<value>
    odbc.ini
    [ACME_POS]
    Driver     = FreeTDS
    Description = ODBC Connection via FreeTDS
    Trace       = 1
    Servername  = 192.168.1.80
    Database    = dbo
    odbcinst.ini
    [PostgreSQL]
    Description                        = ODBC for PostgreSQL
    Driver                   = /usr/lib/psqlodbc.so
    Setup                    = /usr/lib/libodbcpsqlS.so
    Driver64                              = /usr/lib64/psqlodbc.so
    Setup64                              = /usr/lib64/libodbcpsqlS.so
    FileUsage                           = 1
    [MySQL]
    Description                        = ODBC for MySQL
    Driver                   = /usr/lib/libmyodbc5.so
    Setup                    = /usr/lib/libodbcmyS.so
    Driver64                              = /usr/lib64/libmyodbc5.so
    Setup64                              = /usr/lib64/libodbcmyS.so
    FileUsage                           = 1
    [FreeTDS]
    Discription             = TDS driver (Sybase / MS SQL)
    Driver                           = /usr/local/lib/libtdsodbc.so
    # Setup                         = /usr/local/lib/libtdsS.so
    FileUsage                           = 1
    CPTimeout               =
    CPReuse                 =
    [oracle@oraDBsvr etc]$
    freetds.conf
    #   $Id: freetds.conf,v 1.12 2007-12-25 06:02:36 jklowden Exp $
    # This file is installed by FreeTDS if no file by the same
    # name is found in the installation directory. 
    # For information about the layout of this file and its settings,
    # see the freetds.conf manpage "man freetds.conf". 
    # Global settings are overridden by those in a database
    # server specific section
    [global]
            # TDS protocol version
    ;              tds version = 4.2
                   # Whether to write a TDSDUMP file for diagnostic purposes
                   # (setting this to /tmp is insecure on a multi-user system)
    ;              dump file = /tmp/freetds.log
    ;              debug flags = 0xffff
                   # Command and connection timeouts
    ;              timeout = 10
    ;              connect timeout = 10
                   # If you get out-of-memory errors, it may mean that your client
                   # is trying to allocate a huge buffer for a TEXT field.
                   # Try setting 'text size' to a more reasonable limit
                   text size = 64512
    # A typical Sybase server
    [egServer50]
                   host = symachine.domain.com
                   port = 5000
                   tds version = 5.0
    # A typical Microsoft server
    [ACME_POS]
      host = 192.168.1.80
      port = 60801                                # also tried 1433
      instance = SQLEXPRESS
      tds version = 8.0
      client charset = UTF-8
    tsql -LH 192.168.1.80
         ServerName RESOLVEIT-PC
       InstanceName SQLEXPRESS
        IsClustered No
            Version 10.50.4000.0
                tcp 60801
                 np \\RESOLVEIT-PC\pipe\MSSQL$SQLEXPRESS\sql\query
                via RESOLVEIT-PC,0:1433
    Oracle listener:
    [oracle@oraDBsvr log]$ cat /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
    # listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
    # Generated by Oracle configuration tools.
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = acmepos)
    (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
    (PROGRAM = dg4odbc)
    (HS = OK)
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oraDBsvr)(PORT = 1521))
    ADR_BASE_LISTENER = /u01/app/oracle
    [oracle@oraDBsvr log]$ lsnrctl status
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 16-SEP-2013 13:57:41
    Copyright (c) 1991, 2009, Oracle.  All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oraDBsvr)(PORT=1521)))
    STATUS of the LISTENER
    Alias                     LISTENER
    Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
    Start Date                16-SEP-2013 13:50:34
    Uptime                    0 days 0 hr. 7 min. 7 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
    Listener Log File /u01/app/oracle/diag/tnslsnr/oraDBsvr/listener/alert/log.xml
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraDBsvr)(PORT=1521)))
    Services Summary...
    Service "acmepos" has 1 instance(s).
    Instance "acmepos", status UNKNOWN, has 1 handler(s) for this service...
    Service "dw" has 1 instance(s).
    Instance "dw", status READY, has 1 handler(s) for this service...
    Service "dwXDB" has 1 instance(s).
    Instance "dw", status READY, has 1 handler(s) for this service...
    The command completed successfully
    Oracle tnsnames.ora
    [oracle@oraDBsvr admin]$ cat tnsnames.ora
    # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
    # Generated by Oracle configuration tools.
    dw =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = dw)
    acmepos  =
    (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))
    (CONNECT_DATA=(SID=acmepos)
    (HS=OK)
    Oracle sqlnet.ora
    [oracle@oraDBsvr admin]$ cat sqlnet.ora
    # sqlnet.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
    # Generated by Oracle configuration tools.
    NAMES.DIRECTORY_PATH= (EZCONNECT, TNSNAMES)
    ADR_BASE = /u01/app/oracle
    I can connect from the linux server to SQL Server, and query the database:
    [oracle@oraDBsvr etc]$ tsql -S acme_pos -U acme_dw_user -P acme1234
    locale is "en_US.utf8"
    locale charset is "UTF-8"
    using default charset "UTF-8"
    1> select last_name from dbo.employees;
    2> go
    last_name
    Davolio
    Fuller
    Leverling
    Peacock
    Buchanan
    Suyama
    King
    Callahan
    Dodsworth
    (9 rows affected)
    1>
    However, I can’t get a response through Oracle OWB , and I get:
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message: ORA-02063: preceding line from OWB_75
    In the hs log file I get:
    [oracle@oraDBsvr log]$ cat acmepos_agt_3821.trc
    Oracle Corporation --- MONDAY    SEP 16 2013 13:51:22.170
    Heterogeneous Agent Release
    11.2.0.1.0
    HS Gateway:  NULL connection context at exit
    [oracle@oraDBsvr log]$
    I am really stuck now and going round in circles and can’t see the wood for trees! Can anyone please help?!!
    Many Thanks.
    Rafe.

    Let us rewrite your ODBC DSN a little bit... Your current odbc.ini looks like:
    [ACME_POS]
    Driver     = FreeTDS
    Description = ODBC Connection via FreeTDS
    Trace       = 1
    Servername  = 192.168.1.80
    Database    = dbo
    Let us change it a little bit so that we only need one config file - no odbcinst.ini nor freetds.conf file anymore:
    [ACME_POS]
    Driver =/usr/local/lib/libtdsodbc.so
    Server = 192.168.1.80
    Database
    = dbo     ####  I have some doubts that you have a SQL Server database called dbo - one database that always exists is master - so as a test use master here or get the real database name of the SQL Server database you want to connect
    Port = 60801 ## make sure it really is the correct port - best would be to check on the SQL server and then try telnet <ip> <port> if you can connect to the SQL server
    TDS_Version = 8.0
    QuotedId=YES
    Especially the last 2 parameters are mandatory. TDS_Version specifies the TDS Version you have to use to connect to the SQL Server and QuotedID is required for DG4ODBC as it surrounds objevt names by double quotes.
    What happens now when you try to connect with for example isql - the ODBC test utility shipped with the ODBC Driver manager?
    In addition, could you please do me another favour and check the word size of DG4ODBC and the ODBC Driver Manager as well as the ODBC Driver - just execute:
    file /u01/app/oracle/product/11.2.0/dbhome_1/bin/dg4odbc
    file /usr/local/lib/libtdsodbc.so
    file < the patch to your libodbc.so library>/libodbc.so
    and post the output.

  • In Oracle, Can i use if exits clause in a query?

    In Oracle, Can i use if exits clause in a query?
    For example, "Drop table if exists tablename"
    Is the above command valid in oracle?
    If not then is there any equivalent for if exists clause?

    Here is the SP code code that might help you to Drop a table if it exisit, whith out throwing an error if the table is not present.
    create or replace PROCEDURE DROP_TABLE(TabName in Varchar2)
    IS
    temp number:=0;
    tes VARCHAR2 (200) := TabName;
    drp_stmt VARCHAR2 (200):=null;
    BEGIN
    select count(*) into temp from user_tables where TABLE_NAME = tes ;
    if temp =1 then
    drp_stmt := 'Drop Table '||tes;
    EXECUTE IMMEDIATE drp_stmt;
    end if;
    EXCEPTION
    WHEN OTHERS THEN
    raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
    END DROP_TABLE;
    Call this SP in your Scripts by : CALL DROP_TABLE ('<Table Name>')
    Hope this Helps!
    Regards,
    Kaarthiik

  • Oracle team members, this is Q for you...

    Dear members of Oracle OLEDB team, you are the only one who can answer this (one page at oracle.com says that you are monitoring this forum):
    ADO has Cancel method both on Command and Recordset object, which should cancel pending async call (every damn page on Internet says so). Oracle OCI interface has OCIBreak method that does exactly that. Now, why is Cancel method not working anything but waiting till the async call execution is fully completed (the call to Cancel method really blocks the calling thread!!) - it does not cancel anything, it just blocks the code !
    I can expect that Microsoft didn't bother about this "insignificant" issue, but this is Oracle provider for Oracle server written by Oracle... - why is your provider behaving the same ?
    I expect you to reply with really good explanation to this quite important issue, this is not a hundredth-time-"how to retrieve recordset from a stored procedure"-beginners-question
    Thanks in advance.
    P.S.
    Please don't misunderstand, fetching is not a problem, only "heavy" command execution ("heavy" select statement in my case)

    There was, in the early 8.1.7 days at least, a bug in OCI where the break/ cancel call didn't work properly. I have no idea whether it was fixed or not and I've long since forgotten the number. You may be able to find it on metalink. You don't say what version of the client you have or whether you've installed any patchsets for the client. If you're not on the latest patchset for your platform, and your platform isn't at least 8.1.7, I'd strongly suggest upgrading.
    Note that as a general rule, these forums aren't monitored by Oracle developers. From time to time they'll pop by, but it's not something that's likely to be their #1 priority. You could log a TAR on metalink to get an answer from an Oracle person.
    Justin

  • We can figure this standard access list

    We can figure this standard access list that's important remember that we use a standard access list  want to block all traffic or permit all traffic from a particular
    source or destination let's take a look at this machine right here   that  is IP address say
    640-554 we want to stop him from going into the Ethernet interface I'm the ad man he made me midsummer block callers traffic he can get out anymore maybe this is even the internet out
    here we know people like their Internet access so to get back at them I'm a block it what I can do is I can use deny statement in my access list access list
    one did not .
    http://640-554cisco.com/

    Hi Suresh,
    ad 1) according to the documentation ( http://docs.oracle.com/cd/E28280_01/doc.1111/e26692/securityacls.htm#BEIIHJAH )
    "At least one of the following must be true for a user to be granted a particular permission:
    The user's name appears in the xClbraUserList metadata field with the appropriate permission.
    The user belongs to a group that appears in the xClbraAliasList metadata field with the appropriate permission.
    The user is part of an Enterprise role that appears in the xClbraRoleList metadata field with the appropriate permission."
    meaning that OOTB a user will be granted both Read permission as per user-granted permissions and RWD as per group-granted permissions (resulting into RWD because at the same level a union operation is used).
    I'd say that conceptually, the group assignment should not be used in your use-case, because you don't want to assign permissions to group's users, do you? You could create new groups, or use assignment of permissions per user.
    ad 2) check this: http://docs.oracle.com/cd/E28280_01/doc.1111/e26692/securityacls.htm#BEIIDCGD
    Using ACLs, regardless User or Group Access Lists, always impacts the performance. And, it is difficult to maintain. From the information at the link you may understand how it is implemented - basically, the execution of the query will be affected by: a) how many items have to be evaluated b) the length of strings (xClbraUserList, xClbraAliasList) to be evaluated.

  • I want to convert number to hours in oracle 10 like this.

    Dear All
    Some can help me
    I want to convert below MS-SQL query in oracle 10g. please help me.
    for eg:
    Select numasdate,
    Cast(numasdate / 60 as Varchar) + ' hours ' +
    Cast(numasdate % 60 as Varchar) + ' minutes'
    as [TotalHoursAndMinutes]
    From
    #SampleTable
    Output:
    9436 157 hours 16 minutes
    537 8 hours 57 minutes
    9323 155 hours 23 minutes
    12525 208 hours 45 minutes
    Edited by: Parwez on Jan 1, 2013 5:33 AM

    I want to convert number to hours in oracle 10g like this.
    537 8 hours 57 minutes
    9436 157 hours 16 minutes
    12525 208 hours 45 minutesTry this...
    Ranit>> with xx as(
      2      SELECT 537 num from dual UNION ALL
      3       SELECT 9436 num from dual UNION ALL
      4       SELECT 12525 num from dual
      5  )
      6  select
      7       num,
      8       FLOOR(num/60)||' hrs' as "hrs",
      9       MOD(num,60)||' minutes' as "minutes",
    10       FLOOR(num/60)||' hrs  '||MOD(num,60)||' minutes' as "Hours.Mins"
    11  from xx;
           NUM hrs                                          minutes                                          Hours.Mins                                                                                                        
           537 8 hrs                                        57 minutes                                       8 hrs  57 minutes                                                                                                 
          9436 157 hrs                                      16 minutes                                       157 hrs  16 minutes                                                                                               
         12525 208 hrs                                      45 minutes                                       208 hrs  45 minutes                                                                                                Edited by: ranit B on Jan 1, 2013 6:51 PM
    --- Hey John... I just did it and saw your hint now !!!

  • [Oracle JDBC Driver]This driver is locked for use with embedded application

    Hi
    I installed Sun Java Studio Enterprise 8, and am trying to connect to my Oracle database using the attached tutorial code.
    The code compiles fine, but I get the following error whenever I run the file: [Oracle JDBC Driver]This driver is locked for use with embedded application
    I don't understand what is happening.
    Using the Runtime navigation panel on the upper left of the IDE screen, I can right-click and connect to the database, and navigate database files, using the Oracle JDBC Driver that came with JSE8.
    Name: Oracle Driver
    Driver: com.sun.sql.jdbc.oracle.OracleDriver
    Database URL: jdbc:sun:oracle://JAZZPUP:1521;SID=REPO
    If the driver is installed, and can be used to connect to a database by right-clicking on the database definition in the Runtime panel, why can't I connect to it just using java code in the IDE. I would expect both methods to work or to fail, not one of each using the same IDE.
    Many thanks and take care,
    Shayne
    import java.sql.*;
    public class CreateCoffees {
    public static void main(String args[]) {
    //String url = "jdbc:mySubprotocol:myDataSource";
    String url = "jdbc:sun:oracle://JAZZPUP:1521;SID=REPO";
    Connection con;
    String createString;
    createString = "create table COFFEES " +
    "(COF_NAME VARCHAR(32), " +
    "SUP_ID INTEGER, " +
    "PRICE FLOAT, " +
    "SALES INTEGER, " +
    "TOTAL INTEGER)";
    Statement stmt;
    try {
    //Class.forName("myDriver.ClassName");
    Class.forName("com.sun.sql.jdbc.oracle.OracleDriver");
    } catch(java.lang.ClassNotFoundException e) {
    System.err.print("ClassNotFoundException: ");
    System.err.println(e.getMessage());
    try {
    //con = DriverManager.getConnection(url, "myLogin", "myPassword");
    con = DriverManager.getConnection(url, "login", "password");
    stmt = con.createStatement();
    stmt.executeUpdate(createString);
    stmt.close();
    con.close();
    } catch(SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    } //end class CreateCoffees
    ---

    There are two similar threads:
    http://swforum.sun.com/jive/thread.jspa?threadID=61327&tstart=0
    http://swforum.sun.com/jive/thread.jspa?threadID=51057&messageID=188210
    To summarize - the DataDirectDriver that is shipped with the IDE seems to be locked to be used inside the IDE only because of some licensing issues etc..
    That's weird, I agree. I will raise a question on reasons for such a behavior.
    The solution would be to use Oracle's own driver, that is distributed at no charge from their web site - http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html
    HTH,
    Kirill

  • Oracle can not support upto 32 characters table name and field name ?

    hi
    oracle up limitation ?
    create table aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(a char);
    Error
    ORA-00972:identifier too long
    or
    create table a (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa char);
    Error
    ORA-00972:identifier too long
    Oracle can not support upto 32 characters table name and field name ?
    It is true?
    null

    Hello All
    It's been a year after those posts about the limit of identifiers in Oracle Database. Does anybody know what can be done to get rid of that primitive limit? We are developing using Application Servers, Java, generated Code and a very nice object model, in which we can't just use abreviations because of early database age memory shortcomings.
    We are currently using 8i in a very large organization. Is there any chance this version can be configured to allow larger identifiers? Is upgrading to 9i going to solve this problem? Is Oracle Databases really doomed forever because of a 20-year-ago limitation?
    Please, I do like Oracle Databases. I don't want to be flooded with quick answers like "just use 32 character identifiers". I would like to hear a serious solution. Is anybody there still locked in the 8.3 filename paradigm of MS/PC-DOS? Does anybody has to fit an entire Enterprise System in segmented 640Kb of memory? Does anybody has to use monochrome character mode interfaces? Of course not those in the mainstream.
    I also know that other hadrware and software products have lots os limitations. Take Windows 2000. Its command line has a limit of 255 characters! You can't have more than 4GB of memory in a PC! However, one can't expect one mistake to justify others.
    I wish I were very wrong in this respect, and all it should be necessary is to turn on some kind of configuration parameter in 8i to allow us to develop high quality code.
    Thanks for your attention.
    Please, feel free to contact me if you have a solution.
    [email protected]

  • Oracle can only use 2GB on Windwos XP Server

    Hi all,
    Is the following statement true or false:
    "If the Oracle database runs on the Windows XP server (without access to the Datacenter version of Windows), the single-process architecture limits the Oracle database server to about 1.75GB of RAM in total. So, if we have 8GB of RAM on the server, users connected to Oracle can use only about 2GB of it."
    Thanks in advance.

    This was why I posted in the first place... Like I said, it is not just copied (not verbatim, at least not from the edition I read), and it is taken out of context.
    In this case, the chapter talks about how to develop oracle applications, the mentioned section (p 10) has an example of how not to by ignoring how oracle works and hence using more connections than really needed - it is not a chapter about Windows memory architecture.
    According to the link I mentioned above, even XP has ability to use larger-memory techniques e.g. a larger user address space (3GB). But who or which note, doc, etc. is correct? Like Tom always pushes towards, you should not just swallow the bait, instead try to find out what it means yourself, build your own understanding.
    Message was edited by:
    orafad

  • Plz any one can forward this book to me!

    Hello Oracle Masters,
    Plz any one can forward this book to me! my mail id- [email protected]
    " Mastering Oracle PL/SQL: Practical Solutions By CONNOR MCDONALD, WITH CHAIM KATZ, CHRISTOPHER BECK, JOEL R. KALLMAN, AND DAVID C. KNOX"

    user600520 wrote:
    Hello Oracle Masters,I hate titles and salutations like these being thrown around. There are no "+masters+" here.. or "+gurus+".. or any form of so-called superior beings. That is simply a bunch of baloney on the part of those who claim these titles, and kind of pathetic of those who use these titles to curry favour.
    Plz any one can forward this book to me! my mail id- [email protected]
    It is silly to share your e-mail address in a public forum. It only opens your mailbox to abuse and spam
    " Mastering Oracle PL/SQL: Practical Solutions By CONNOR MCDONALD, WITH CHAIM KATZ, CHRISTOPHER BECK, JOEL R. KALLMAN, AND DAVID C. KNOX"Books are usually copyrighted and cannot be electronically copied and shared as that would be illegal. And I'm sure that you do not want to commit a crime...
    There are however books that can be read (and downloaded) on the Internet for free. Try http://docstore.mik.ua/orelly/oracle/ - these contains such books, dealing with PL/SQL.

  • What is this error and how i can solve this?

    I got this error in my alertlog.
    ORA-000060: Deadlock detected. More info in file D:\oracle\admin\TEMPDB\udump\ORA06816.TRC.
    why this error occur and how i can solve this.

    Hi,
    Here is the cause and action information about ORA-000060 error
    Cause: Your session and another session are waiting for a resource locked by the other. This condition is known as a deadlock. To resolve the deadlock, one or more statements were rolled back for the other session to continue work.
    Action: Either:
    Enter a ROLLBACK statement and re-execute all statements since the last commit or
    Wait until the lock is released, possibly a few minutes, and then re-execute the rolled back statements.
    For more information on any error code refer to the Oracle Error Messages Documentation.
    Hope this helps.
    Sujatha.

Maybe you are looking for

  • How to add a button on the ALV LIST pop up

    Hi , Can any one help me to add a button on the ALV list which is a pop up using ABAP Objects. Thanks in advance. Regards, Kavya.

  • DHCP with manual address doesn't work

    My ISP has decided that they won't support static addresses for the DHCP servers anymore. I'd really like to keep static IP addresses, so I tried using the "DHCP with manual address." Unfortunately, it doesn't recognize my Router which is serving DHC

  • Java.lang.ClassCastException  in local lookups

    hi, i have written two ejb projects named as proj1 and proj2. i deployed proj1 as EAR1 and proj2 as EAR2.(in same server) in proj1 Sessionbean1  i need to use(lookup) proj2 Sessionbean2 . <b>i have given jndi name for proj2 Sessionbean2 as "jndiproj2

  • PDF in Safari Question

    If viewing a pdf in safari, can you set it up so that there are controls, like in preview to jump to the next page, etc. Or do I always have to open it in preview....

  • OLE Objects - How to open them in Java?

    Hello ppl, An OLE Object contains a header set by the Access Database and the file itself. I just quit trying to find a way to remove the OLE header and get only the file, once the file inside the OLE Object might be from a lot of types, like docs, o