Alternative to union in Oracle 10g
Below is the sql using union that I am using currently. There are 64 columns from 3 different tables. Out of all the columns only one column value is a constant to get 2 records.
select col1, col2, col3,...., 'DE' medium_val
from table1, table2, table3
where table1.col1 = table2.col1
and table2.col1 = table3.col1
and other criteria
union
select col1, col2, col3,...., 'WG' medium_val
from table1, table2, table3
where table1.col1 = table2.col1
and table2.col1 = table3.col1
and other criteria
Basically just repeating the same code just for one column value. Is there any other alternative to union to avoid querying the same tables twice.
Hi,
Here's one way that will work in Oracle 9 (or higher):
WITH all_medium_vals AS
SELECT 'DE' AS medium_val FROM dual UNION ALL
SELECT 'WG' FROM dual
SELECT col1, col2, col3, ....
, m.medium_val
FROM table1
, table2
, table3
, all_medium_vals m
WHERE table1.col1 = table2.col1
AND table2.col1 = table3.col1
AND ...
;Don't reference m.medium_val in the WHERE clause. By leaving it out, you'll do a cross-join of your result set from table1, table2 and table3 with the 2 rows in all_medium_vals.
Starting in Oracle 11, there's also SELECT ... UNPIVOT.
You'll notice this query is still doing a UNION, but it's just doing the UNION of two rows, and then doing the complicated query only once. That will be a lot more efficient than doing the complicated query twice, and then doing a UNION of however many rows that happend to produce. There are ways to generate all_medium_vals without a UNION, but they are not as easy to understand or debug, and not significantly more efficient.
Similar Messages
-
How to tune the following sql statements which has two unions in oracle 10g
It takes a long time to run the following sql statement in 10g. Each select brings back about 4 million rows and there will be about 12 million rows. When I run each select statements seprately in sqlplus I can see the data immedaitely but when I run it as whole with two unions in the select it just takes very very long time? I want to know how to make this run faster? Can we add hints? or is it because of any table space? Any help is appreciated.
select
D.EMPLID
,D.COMPANY
,'CY'
,D.CALENDAR_YEAR
,D.QTRCD
,D.ERNCD
,D.MONTHCD
,D.MONTHCD
,D.GRS_MTD
,D.GRS_QTD
,D.GRS_YTD
,D.HRS_MTD
,D.HRS_QTD
,D.HRS_YTD
from PS_EARNINGS_BAL D
where D.SPCL_BALANCE = 'N'
union
select
D.EMPLID
,D.COMPANY
,'FY'
,(case when D.MONTHCD > '06' then D.CALENDAR_YEAR + 1 else D.CALENDAR_YEAR end)
,ltrim(to_char(to_number(D.QTRCD) + decode(sign(3-to_number(D.QTRCD)),1,2,-2),'9'))
,D.ERNCD
,ltrim(to_char(to_number(D.MONTHCD) + decode(sign(7-to_number(D.MONTHCD)),1,6,-6),'09'))
,D.MONTHCD
,D.GRS_MTD
,D.GRS_QTD
,(select sum(F.GRS_MTD) from PS_EARNINGS_BAL F where
F.EMPLID = D.EMPLID and
F.COMPANY = D.COMPANY and
F.ERNCD = D.ERNCD and
F.SPCL_BALANCE = D.SPCL_BALANCE and
(case when F.MONTHCD < '07' then F.CALENDAR_YEAR -1 else F.CALENDAR_YEAR end)
= (case when D.MONTHCD < '07' then D.CALENDAR_YEAR -1 else D.CALENDAR_YEAR end)
and to_number(F.MONTHCD) + decode(sign(7-to_number(F.MONTHCD)),1,6,-6)
<= to_number(D.MONTHCD) + decode(sign(7-to_number(D.MONTHCD)),1,6,-6))
,D.HRS_MTD
,D.HRS_QTD
,(select sum(F.HRS_MTD) from PS_EARNINGS_BAL F where
F.EMPLID = D.EMPLID and
F.COMPANY = D.COMPANY and
F.ERNCD = D.ERNCD and
F.SPCL_BALANCE = D.SPCL_BALANCE and
(case when F.MONTHCD < '07' then F.CALENDAR_YEAR -1 else F.CALENDAR_YEAR end)
= (case when D.MONTHCD < '07' then D.CALENDAR_YEAR -1 else D.CALENDAR_YEAR end)
and to_number(F.MONTHCD) + decode(sign(7-to_number(F.MONTHCD)),1,6,-6)
<= to_number(D.MONTHCD) + decode(sign(7-to_number(D.MONTHCD)),1,6,-6))
from PS_EARNINGS_BAL D
where D.SPCL_BALANCE = 'N'
union
select
D.EMPLID
,D.COMPANY
,'FF'
,(case when D.MONTHCD > '09' then D.CALENDAR_YEAR + 1 else D.CALENDAR_YEAR end)
,ltrim(to_char(to_number(D.QTRCD)+decode(sign(4-to_number(D.QTRCD)),1,1,-3),'9'))
,D.ERNCD
,ltrim(to_char(to_number(D.MONTHCD)+decode(sign(10-to_number(D.MONTHCD)),1,3,-9),'09'))
,D.MONTHCD
,D.GRS_MTD
,D.GRS_QTD
,(select sum(F.GRS_MTD) from PS_EARNINGS_BAL F where
F.EMPLID = D.EMPLID and
F.COMPANY = D.COMPANY and
F.ERNCD = D.ERNCD and
F.SPCL_BALANCE = D.SPCL_BALANCE and
(case when F.MONTHCD < '10' then F.CALENDAR_YEAR -1 else F.CALENDAR_YEAR end)
= (case when D.MONTHCD < '10' then D.CALENDAR_YEAR -1 else D.CALENDAR_YEAR end)
and to_number(F.MONTHCD)+decode(sign(4-to_number(F.MONTHCD)),1,9,-3)
<= to_number(D.MONTHCD)+decode(sign(4-to_number(D.MONTHCD)),1,9,-3))
,D.HRS_MTD
,D.HRS_QTD
,(select sum(F.HRS_MTD) from PS_EARNINGS_BAL F where
F.EMPLID = D.EMPLID and
F.COMPANY = D.COMPANY and
F.ERNCD = D.ERNCD and
F.SPCL_BALANCE = D.SPCL_BALANCE and
(case when F.MONTHCD < '10' then F.CALENDAR_YEAR -1 else F.CALENDAR_YEAR end)
= (case when D.MONTHCD < '10' then D.CALENDAR_YEAR -1 else D.CALENDAR_YEAR end)
and to_number(F.MONTHCD)+decode(sign(4-to_number(F.MONTHCD)),1,9,-3)
<= to_number(D.MONTHCD)+decode(sign(4-to_number(D.MONTHCD)),1,9,-3))
from PS_EARNINGS_BAL D
where D.SPCL_BALANCE = 'N'
Edited by: user5846372 on Mar 11, 2009 8:55 AMHi,
What i observed is that your table name and where clause is same in all the thress SELECTs whereas columns having some manipulations that is not going to be unique. I guess you can easily replace UNION with UNION ALL.
from PS_EARNINGS_BAL D
where D.SPCL_BALANCE = 'N'Note: I am not aware of your data and business requirement. Please test the result before removing. It is just a suggetion
Cheers,
Avinash -
Alternative to UNION SQL Oracle 11g
Hi,
is any possibility to replace this SQL statement with another one?
Be aware that this one works and the tables are not identical.
String statement =" SELECT id, "+
" sender_id, "+
" date_created "+
" FROM DOCUMENT_ARCHIVE da "+
" where da.SOURCE_FILE_NAME = 'shpaig0140_shpsts_shpaig_C2KRMP1.txt' "+
" union all "+
" select file_id,"+
" sender_id,"+
" date_created "+
" from DOCUMENT_FILE df "+
" WHERE df.SOURCE_FILE_NAME = 'shpaig0140_shpsts_shpaig_C2KRMP1.txt' ";Why do you feel the need to replace it if it gives correct results? If you need to union, then you need to union. Most other structures would not give identical results, that is, one row for each occurrence in each table.
About the only change that you could make would be to create a view along the lines of:
CREATE VIEW combined AS
SELECT id, sender_id, date_created, source_file_name
FROM document_archive
UNION ALL
SELECT id, sender_id, date_created, source_file_name
FROM document_fileThen query the view like:
SELECT id, sender_id, date_created
FROM combined
WHERE source_file_name = 'shpaig0140_shpsts_shpaig_C2KRMP1.txt' As a side note, I hope that your real code uses bind variables instead of string literals.
John -
Oracle 10G New Feature........Part 1
Dear all,
from last couple of days i was very busy with my oracle 10g box,so i think this is right time to
share some intresting feature on 10g and some internal stuff with all of you.
Have a look :-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Oracle 10g Memory and Storage Feature.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1.Automatic Memory Management.
2.Online Segment Shrink
3.Redolog Advisor, checkpointing
4.Multiple Temporary tablespace.
5.Automatic Workload Repository
6.Active Session History
7.Misc
a)Rename Tablespace
b)Bigfile tablespace
c)flushing buffer cache
8.ORACLE INTERNAL
a)undocumented parameter (_log_blocks_during_backup)
b)X$ view (x$messages view)
c)Internal Structure of Controlfile
1.Automatic memory management
================================
This feature reduce the overhead of oracle DBA.previously mostly time we need to set diff oracle SGA parameter for
better performance with the help of own experience,advice views and by monitoring the behaviour
of oracle database.
this was just time consuming activity.........
Now this feature makes easy life for oracle DBA.
Just set SGA_TARGET parameter and it automatically allocate memory to different SGA parameter.
it focus on DB_CACHE_SIZE
SHARED_POOL_SIZE
LARGE_POOL
JAVA_POOL
and automatically set it as
__db_cache_size
__shared_pool_size
__large_pool_size
__java_pool_size
check it in alert_log
MMAN(memory manager) process is new in 10g and this is responsible for sga tuning task.
it automatically increase and decrease the SGA parameters value as per the requirement.
Benefit:- Maximum utlization of available SGA memory.
2.Online Segment Shrink.
==========================
hmmmmm again a new feature by oracle to reduce the downtime.Now oracle mainly focus on availablity
thats why its always try to reduce the downtime by intrducing new feature.
in previous version ,reducing High water mark of table was possible by
Exp/imp
or
alter table move....cmd. but on these method tables was not available for normal use for long hrs if it has more data.
but in 10g with just few command we can reduce the HWmark of table.
this feature is available for ASSM tablespaces.
1.alter table emp enable row movement.
2.alter table emp shrink space.
the second cmd have two phases
first phase is to compact the segment and in this phase DML operations are allowed.
second phase(shrink phase)oracle shrink the HWM of table, DML operation will be blocked at that time for short duration.
So if want to shrink the HWM of table then we should use it with two diff command
first compact the segment and then shrink it on non-peak hrs.
alter table emp shrink space compact. (This cmd doesn't block the DML operation.)
and alter table emp shrink space. (This cmd should be on non-peak hrs.)
Benefit:- better full table scan.
3.Redolog Advisor and checkpointing
================================================================
now oracle will suggest the size of redo log file by V$INSTANCE_RECOVERY
SELECT OPTIMAL_LOGFILE_SIZE
FROM V$INSTANCE_RECOVERY
this value is influence with the value of FAST_START_MTTR_TARGET .
Checkpointing
Automatic checkpointing will be enable after setting FAST_START_MTTR_TARGET to non-zero value.
4.Multiple Temporary tablespace.
==================================
Now we can manage multiple temp tablespace under one group.
we can create a tablespace group implicitly when we include the TABLESPACE GROUP clause in the CREATE TEMPORARY TABLESPACE or ALTER TABLESPACE statement and the specified tablespace group does not currently exist.
For example, if group1 is not exists,then the following statements create this groups with new tablespace
CREATE TEMPORARY TABLESPACE temp1 TEMPFILE '/u02/oracle/data/temp01.dbf'
SIZE 50M
TABLESPACE GROUP group1;
--Add Existing temp tablespace into group by
alter tablespace temp2 tablespace group group1.
--we can also assign the temp tablespace group on database level as default temp tablespace.
ALTER DATABASE <db name> DEFAULT TEMPORARY TABLESPACE group1;
benefit:- Better I/O
One sql can use more then one temp tablespace
5.AWR(Automatic Workload Repository):-
================================== AWR is built in Repository and Central point of Oracle 10g.Oracle self managing activities
is fully dependent on AWR.by default after 1 hr, oracle capure all database uses information and store in AWR with the help of
MMON process.we called it Memory monitor process.and all these information are kept upto 7 days(default) and after that it automatically purge.
we can generate a AWR report by
SQL> @?/rdbms/admin/awrrpt
Just like statspack report but its a advance and diff version of statspack,it provide more information of Database as well as OS.
it show report in Html and Text format.
we can also take manually snapshot for AWR by
BEGIN
DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT ();
END;
**The STATISTICS_LEVEL initialization parameter must be set to the TYPICAL or ALL to enable the Automatic Workload Repository.
[oracle@RMSORA1 oracle]$ sqlplus / as sysdba
SQL*Plus: Release 10.1.0.2.0 - Production on Fri Mar 17 10:37:22 2006
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> @?/rdbms/admin/awrrpt
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
4174002554 RMSORA 1 rmsora
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Would you like an HTML report, or a plain text report?
Enter 'html' for an HTML report, or 'text' for plain text
Defaults to 'html'
Enter value for report_type: text
Type Specified: text
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
* 4174002554 1 RMSORA rmsora RMSORA1
Using 4174002554 for database Id
Using 1 for instance number
Specify the number of days of snapshots to choose from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entering the number of days (n) will result in the most recent
(n) days of snapshots being listed. Pressing <return> without
specifying a number lists all completed snapshots.
Listing the last 3 days of Completed Snapshots
Snap
Instance DB Name Snap Id Snap Started Level
rmsora RMSORA 16186 16 Mar 2006 17:33 1
16187 16 Mar 2006 18:00 1
16206 17 Mar 2006 03:30 1
16207 17 Mar 2006 04:00 1
16208 17 Mar 2006 04:30 1
16209 17 Mar 2006 05:00 1
16210 17 Mar 2006 05:31 1
16211 17 Mar 2006 06:00 1
16212 17 Mar 2006 06:30 1
16213 17 Mar 2006 07:00 1
16214 17 Mar 2006 07:30 1
16215 17 Mar 2006 08:01 1
16216 17 Mar 2006 08:30 1
16217 17 Mar 2006 09:00 1
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 16216
Begin Snapshot Id specified: 16216
Enter value for end_snap: 16217
End Snapshot Id specified: 16217
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_1_16216_16217.txt. To use this name,
press <return> to continue, otherwise enter an alternative.
Benefit:- Now DBA have more free time to play games.....................:-)
Advance version of statspack
more DB and OS information with self managing capabilty
New Automatic alert and database advisor with the help of AWR.
6.Active Session History:-
==========================
V$active_session_history is view that contain the recent session history.
the memory for ASH is comes from SGA and it can't more then 5% of Shared pool.
So we can get latest and active session report from v$active_session_history view and also get histortical data of
of session from DBA_HIST_ACTIVE_SESS_HISTORY.
v$active_session_history include some imp column like:-
~SQL identifier of SQL statement
~Object number, file number, and block number
~Wait event identifier and parameters
~Session identifier and session serial number
~Module and action name
~Client identifier of the session
7.Misc:-
========
Rename Tablespace:-
=================
in 10g,we can even rename a tablespace by
alter tablespace <tb_name> rename to <tb_name_new>;
This command will update the controlfile,data dictionary and datafile header,but dbf filename will be same.
**we can't rename system and sysaux tablespace.
Bigfile tablespace:-
====================
Bigfile tablespace contain only one datafile.
A bigfile tablespace with 8K blocks can contain a 32 terabyte datafile.
Bigfile tablespaces are supported only for locally managed tablespaces with automatic segment-space management.
we can take the advantage of bigfile tablespace when we are using ASM or other logical volume with RAID.
without ASM or RAID ,it gives poor response.
syntax:-
CREATE BIGFILE TABLESPACE bigtbs
Flushing Buffer Cache:-
======================
This option is same as flushing the shared pool,but only available with 10g.
but i don't know, whats the use of this command in prod database......
anyway we can check and try it on test server for tuning n testing some query etc....
SQL> alter system flush buffer_cache;
System altered.
++++++++++++++++++
8.Oracle Internal
++++++++++++++++++
Here is some stuff that is not related with 10g but have some intresting things.
a)undocumented parameter "_log_blocks_during_backup"
++++++++++++++++++++++++
as we know that oracle has generate more redo logs during hotbackup mode because
oracle has to maintain the a complete copy of block into redolog due to split block.
we can also change this behaviour by setting this parameter to False.
If Oracle block size equals the operating system block size.thus reducing the amount of redo generated
during a hot backup.
WITHOUT ORACLE SUPPORT DON'T SET IT ON PROD DATABASE.THIS DOCUMENT IS JUST FOR INFORMATIONAL PURPOSE.
b)some X$ views (X$messages)
++++++++++++++++
if you are intresting in oracle internal architecture then x$ view is right place for getting some intresting things.
X$messages :-it show all the actions that a background process do.
select * from x$messages;
like:-
lock memory at startup MMAN
Memory Management MMAN
Handle sga_target resize MMAN
Reset advisory pool when advisory turned ON MMAN
Complete deferred initialization of components MMAN
lock memory timeout action MMAN
tune undo retention MMNL
MMNL Periodic MQL Selector MMNL
ASH Sampler (KEWA) MMNL
MMON SWRF Raw Metrics Capture MMNL
reload failed KSPD callbacks MMON
SGA memory tuning MMON
background recovery area alert action MMON
Flashback Marker MMON
tablespace alert monitor MMON
Open/close flashback thread RVWR
RVWR IO's RVWR
kfcl instance recovery SMON
c)Internal Structure of Controlfile
++++++++++++++++++++++++++++++++++++
The contents of the current controlfile can be dumped in text form.
Dump Level Dump Contains
1 only the file header
2 just the file header, the database info record, and checkpoint progress records
3 all record types, but just the earliest and latest records for circular reuse record types
4 as above, but includes the 4 most recent records for circular reuse record types
5+ as above, but the number of circular reuse records included doubles with each level
the session must be connected AS SYSDBA
alter session set events 'immediate trace name controlf level 5';
This dump show lots of intresting information.
it also show rman recordes if we used this controlfile in rman backup.
Thanks
Kuljeet Pal SinghYou can find each doc in html and pdf format on the Documentation Library<br>
You can too download all the documentation in html format to have all on your own computer here (445.8MB)<br>
<br>
Nicolas. -
Nested tables and multiset operators in Oracle 10g
Consider the following scenario:
We have two identical relations R and S defined as:
CREATE TABLE R(
a INTEGER,
b table_type)
NESTED TABLE b STORE as b_1;
CREATE TABLE S(
a INTEGER,
b table_type)
NESTED TABLE b STORE as b_2;
where table_typ is defined as
CREATE TYPE table_typ AS TABLE OF VARCHAR2(8);
Suppose we have two instances of R and S, each having one tuple as follows: R(1,table_typ('a','b')) and S(1,table_typ('b','c')).
I would like to "merge" these two simple instances (e.g., achieve the effect of a simple SELECT * FROM R UNION SELECT * FROM S query) and obtain the following resulting instance: Result(1,table_typ('a','b','c')).
Would this be possible in Oracle 10g? A simple UNION does not work (I got a "inconsistent datatypes: expected - got SCOTT.TABLE_TYP" error). I also took a look at the MULTISET UNION operator over nested tables available in Oracle 10g, but it doesn't seem to get me anywhere. Any help on this would be greatly appreciated.
Thank you,
LauraOracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> CREATE OR REPLACE TYPE table_type AS TABLE OF VARCHAR2 (8);
2 /
Type created.
SQL> CREATE TABLE r(
2 a INTEGER,
3 b table_type)
4 NESTED TABLE b STORE as b_1;
Table created.
SQL> CREATE TABLE s(
2 a INTEGER,
3 b table_type)
4 NESTED TABLE b STORE as b_2;
Table created.
SQL> INSERT INTO r VALUES (1, table_type ('a', 'b'));
1 row created.
SQL> INSERT INTO s VALUES (1, table_type ('b', 'c'));
1 row created.
SQL> COLUMN c FORMAT A10;
SQL> SELECT r.a, r.b MULTISET UNION DISTINCT s.b c
2 FROM r, s
3 WHERE r.a = s.a;
A C
1 TABLE_TYPE('a', 'b', 'c')
SQL> -
Not able to access Oracle 10g XE database home page on Windows XP?
I wanted to practise pl/sql in my office pc. I installed Oracle 10g XE on my machine and after that I also started Agent from Services. However When i clicked on Database home page it doesn't start. Changing network configuration might create problem in network. Can anybody help me working out this problem or has any alternative to practise PL/SQL with tiny oracle database.
Regards
Manish
Edited by: user11003855 on Apr 19, 2009 11:27 PMDid you configure loopback adapter?
:p -
Reg.SMTP Error while using UTL_MAIL in Oracle 10g
Hi,
I am getting the following SMTP error while trying to use the UTL.MAIL package of Oracle 10g. The query is as follows.
begin
utl_mail.send(
sender => 'NAVEEN',
recipients => '[email protected]',
subject => 'Testing utl_mail',
message => 'The receipt of this email means'|| ' that UTL_MAIL works'
end;
UTL_MAIL package is installesd and the port 25 is configured and firewall is changed.
The same block was working fine before 5 days and now is giving the error as
ORA-29279: SMTP permanent error: 501 badly formatted MAIL FROM user - no "<"
ORA-06512: at "SYS.UTL_SMTP", line 21
ORA-06512: at "SYS.UTL_SMTP", line 99
ORA-06512: at "SYS.UTL_SMTP", line 222
ORA-06512: at "SYS.UTL_MAIL", line 407
ORA-06512: at "SYS.UTL_MAIL", line 594
ORA-06512: at line 2
Could you please help me out how to proceed???
Regards,
Naveen Kumar.Can you back that statement about an Oracle UTL_SMTP bug up with an actual bug number??
From what you have posted, this is not a bug!! but expected and documented (RFC'ed) SMTP server behaviour.
My proof:
/home/billy> telnet mail 25
Trying 165.143.128.26...
Connected to mail
Escape character is '^]'.
220 CNTRRA20-GTW01 [CNTRRA20-GTW01] Thu, 06 Mar 2008 14:26:26 +0200
HELO 10.251.93.58
250 CNTRRA20-GTW01 Hello [10.251.93.58]
MAIL FROM: naveen <[email protected]>
501 naveen <[email protected]> : illegal character(s) in domain string
MAIL FROM: NAVEEN
501 NAVEEN : domain string is NULL.
quit
221 CNTRRA20-GTW01 closing connection. Goodbye!
Connection closed by foreign host.
/home/billy>
As you can clearly see, the SMTP server expects a DOMAIN name as part of the MAIL FROM address. It also does not accept the alternative format suggested.
Yes, not all SMTP servers are equal and some support additional formatting.
But to imply that because the SMTP server does not accept your address formatted as string NAVEEN, it is a UTL_SMTP problem, sounds like a smelly one to me. -
How to Switch between Databases in ORACLE 10g?
Hi friends, im using ORACLE 10g.
I have two databases namely ORCL and ORCL1.
First I created ORCL and later ORCL1.
Now I am able to see the tables from ORCL1 only.
How can I switch to ORCL?
Thanks in advance.Hi Aman, I am posting the results below.
From the command prompt:
C:\>SET ORACLE_SID=ORCL
C:\>SQLPLUS
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Feb 19 18:12:24 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter user-name: scott
Enter password:
Connected to:
Oracle Database 10g Release 10.2.0.1.0 - Production
SQL> SELECT * FROM TAB;
TNAME TABTYPE CLUSTERID
DEPT TABLE
EMP TABLE
BONUS TABLE
SALGRADE TABLE
SB4782 TABLE
EDNLN270042 TABLE
CASE_DETAILS TABLE
7 rows selected.
SQL>
And from the SQL*Plus Editor:
SQL> SET ORACLE_SID=ORCL;
SP2-0735: unknown SET option beginning "ORACLE_SID..."
SQL> SELECT * FROM TAB;
TNAME TABTYPE CLUSTERID
DEPT TABLE
EMP TABLE
BONUS TABLE
SALGRADE TABLE
SQL>
So, I am able to get the tables through the command prompt.
But from the SQL*Plus Editor, I am not getting them.
How to get those tables(from ORCL) through the SQL*Plus editor?
Is there any other alternative for setting the ORACLE_SID permanently?
Thank you. -
Rollup/Cube Operation in Oracle 10g
I'm using Oracle 10g as my database.
Suppose I have a table that has data:
ID SEMESTER SUBJECT MARKS
9 4 Maths 50
9 4 Science 45
9 4 English 42
10 5 Maths 56
10 5 History 23
Now the output should look like this
ID SEMESTER SUBJECT MARKS RANK
9 4 Maths 50
Science 45
English 42
Total 137 1
10 5 Maths 56
History 23
Total 79 2
Can anybody please help me out.
Thanx in advanceSelect * from tmp_sp_marks
SEMESTER SUBJECT MARKS STUDID
3 Maths 40 8
3 English 52 8
3 ujarati 40 8
4 Science 45 9
4 English 42 9
5 Maths 43 10
5 English 44 10
4 Maths 50 9
select case when rn = 1 then studid else null end studid,
case when rn = 1 then semester else null end semester,
subject,
marks,
case when subject = 'Total' then rank else null end rank
from
select studid, semester, subject, marks, max(rank) over(partition by studid, semester) rank,
row_number() over(partition by studid, semester order by marks) rn
from
select studid, semester, subject, marks, 0 rank from tmp_sp_marks a
union
select studid, semester, 'Total', sm, dense_rank() over(order by sm desc) rank
from (
select studid, semester, sum(marks) sm
from tmp_sp_marks
group by rollup(studid, semester) )
where studid is not null and semester is not null
order by max(rank) over(partition by studid, semester) desc , marks asc
OUTPUT:
STUDID SEMESTER SUBJECT MARKS RANK
8 3 Maths 40
Gujarati 40
English 52
Total 132 2
9 4 English 42
Science 45
Maths 50
Total 137 1
10 5 Maths 43
English 44
Total 87 3 -
Error in GetCurrentDir(): 13 when installing oracle 10g software
Hi Basis Expert,
We are doing an Mock System Upgrade.
So now we are installing
Before upgrade
BW 3.5 with oracle 10g (10.2.0.4)
After upgrade
BI 7.0 with oracle 11g (11.2.0.4)
When installing the Oracle 10g software we are getting an error
Error in GetCurrentDir(): 13
Error in GetCurrentDir(): 13
Error in GetCurrentDir(): 13
Starting Oracle Universal Installer...
Our OS is AIX 5.3
Please help us in fixing this issue
Regards,
Anil Shenoy[While Installing Oracle software facing "Error in GetCurrentDir(): 13" [ID 378393.1]|https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&id=378393.1]
Solution
In order to get rid of this problem, please check for the following.
1. You are logged in as the oracle user and group which owns the oraInventory (if this is not the first install on this system)
2. You have read/execute permissions on the source files/directories (CD-ROMor CD-ROM image)
3. You have write permissions on the target directory (ORACLE_HOME)
4. When the target filesystem for ORACLE_HOME is unmounted the directory for the mount point has rwx permissions for the oracle user
If this is the first Oracle software to be installed on this system you can ignore item 1 as it will create a new oraInventory with the correct permissions. For item 4, unmount the filesystem and "chmod 777" the directory used for the mount point, then remount the filesystem. Item 4 is actually a somewhat frequent issue on AIX.
If none of the above solves your problem, the only alternative left would be, to copy the Staging directory (Disk1 of Install) to /tmp directory and proceed with the installation. -
ORA-12157 when installing Oracle 10g on Fedora 5?
Hi, Im installing Oracle 10g on Fedora 5, I did it once, but when I tried to set it up again I
got this error on the last part of the install...
ORA-12157: TNS: internal network communication error
Anybody know what might cause this?
I think I have installed all required RPMs and set environment variables, kernel parameters,
created oracle users and groups as needed, but still get the above error. I searched the error and some claim it is a problem using newer glibc 2.4.4, so I tried installing on Fedora 4 and had the same error even with glibc 2.3???
Thanks so much,
JonOracle Database 10g Release 2 (10.2.0.1) Installation On Fedora Core 5 (FC5 X86) Step by Step
This is a Server Installation with a minimum of 2G swap, secure Linux disabled and the following package groups installed:
Editors
Graphical Internet
Administration Tools
Base
X Window System
System Tools
Server Configuration Tools
GNOME Desktop Environment
Development Libraries
Development Tools
Legacy Development Support
Legacy Server Support
Alternative installations may require more packages to be loaded, in addition to the ones listed below.
Download Software
Unpack Files
Hosts File
Set Kernel Parameters
Setup
Installation
Post Installation
Download Software
Download the following software:
Oracle Database 10g Release 2 (10.2.0.1) Software
openmotif21-2.1.30-14.i386.rpm
Unpack Files
Unzip the files:
unzip 10201_database_linux32.zipYou should now have a single directory containing installation files. Depending on the age of the download this may either be named "db/Disk1" or "database".
Hosts File
The /etc/hosts file must contain a fully qualified name for the server:
<IP-address> <fully-qualified-machine-name> <machine-name>Set Kernel Parameters
Add the following lines to the /etc/sysctl.conf file:
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144Run the following command to change the current kernel parameters:
/sbin/sysctl -pAdd the following lines to the /etc/security/limits.conf file:
* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536Add the following line to the /etc/pam.d/login file, if it does not already exist:
session required /lib/security/pam_limits.soDisable secure linux by editing the /etc/selinux/config file, making sure the SELINUX flag is set as follows:
SELINUX=disabledAlternatively, this alteration can be done using the GUI tool (Desktop > System Settings > Security Level). Click on the SELinux tab and disable the feature.
Setup
Install the following packages:
# From Fedora Core 5 DVD
cd /media/dvd/Fedora/RPMS
rpm -Uvh setarch-*
rpm -Uvh --force tcl-*
rpm -Uvh libXp-*
rpm -Uvh openmotif-2*
rpm -Uvh compat-db-*
rpm -Uvh compat-libstdc++-33*
rpm -Uvh compat-libf2c-32-*
rpm -Uvh compat-gcc-32-*
rpm -Uvh libaio-*
rpm -Uvh compat-gcc-32-c++-*
rpm -Uvh compat-libstdc++-296*
rpm -Uvh compat-libgcc-296*
# From download
rpm -Uvh openmotif21-2.1.30-14.i386.rpmCreate the new groups and users:
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba oracle
passwd oracleCreate the directories in which the Oracle software will be installed:
mkdir -p /u01/app/oracle/product/10.2.0/db_1
chown -R oracle.oinstall /u01Login as root and issue the following command:
xhost +<machine-name>Edit the /etc/redhat-release file replacing the current release information (Fedora Core release 5 (Bordeaux)) with the following:
redhat-4Login as the oracle user and add the following lines at the end of the .bash_profile file:
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=TSH1; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fiInstallation
Log into the oracle user. If you are using X emulation then set the DISPLAY environmental variable:
DISPLAY=<machine-name>:0.0; export DISPLAYStart the Oracle Universal Installer (OUI) by issuing the following command in the database directory:
./runInstallerEnter the appropriate ORACLE_HOME and name then continue with the installation.
During the installation, before the linking phase, edit the contents of the "$ORACLE_HOME/bin/gennttab" file, amending the following entries:
# Change this...
LIB=`$ECHO ${TtoLIB} | $SED 's/ /\\
/g' | $GREP "^${T}:" | $AWK -F: '{print $2}'`
INI=`$ECHO ${TtoINI} | $SED 's/ /\\
/g' | $GREP "^${T}:" | $AWK -F: '{print $2}'`
BAS=`$ECHO ${TtoBAS} | $SED 's/ /\\
/g' | $GREP "^${T}:" | $AWK -F: '{print $2}'`
# To this...
LIB=`$ECHO ${TtoLIB} | $SED 's/ /\n/g' | $GREP "^${T}:" | $AWK -F: '{print $2}'`
INI=`$ECHO ${TtoINI} | $SED 's/ /\n/g' | $GREP "^${T}:" | $AWK -F: '{print $2}'`
BAS=`$ECHO ${TtoBAS} | $SED 's/ /\n/g' | $GREP "^${T}:" | $AWK -F: '{print $2}'`If you don't do this the ntcontab will hang indefinitely during the linking phase.
Post Installation
Edit the /etc/redhat-release file restoring the original release information:
Fedora Core release 5 (Bordeaux)Finally edit the /etc/oratab file setting the restart flag for each instance to 'Y':
TSH1:/u01/app/oracle/product/10.2.0/db_1:Y
Ref.: http://www.oracle-base.com/articles/10g/OracleDB10gR2InstallationOnFedora5.php -
Win32 Oracle 10g Database Server Installation problems
Hello,
I have recently installed the Oracle 10g Database Server for Win32. The installation seemed to be successful. I used the Enterprise option and all the suggested defaults. Ihave the following services installed and started after the installation:
o OracleDBConsoleORCL [started]
o OracleOraDb10g_home1iSQL*Plus [started]
o OracleOraDb10g_home1SNMPPeerEncapsulator [manual]
o OracleOraDb10g_home1SNMPPeerMasterAgent [manual]
o OracleOraDb10g_home1TNSListener [started]
o OracleServiceORCL [started]
I have created the following files:
# LISTENER.ORA Network Configuration File: d:\oracle10gServer\network\admin\listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = asparuh)(PORT = 1521))
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = d:\oracle10gServer)
(PROGRAM = extproc)
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = d:\oracle10gServer)
(SID_NAME = ORCL)
# TNSNAMES.ORA Network Configuration File: d:\oracle10gServer\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = asparuh)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL)
INST1_HTTP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = asparuh)(PORT = 1521))
(CONNECT_DATA =
(SERVER = SHARED)
(SERVICE_NAME = MODOSE)
(PRESENTATION = http://HRService)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
I go to the DOS console and type:
c:> sqlplus scott/tiger@ORCL
and I get:
ERROR: ORA-28000: the account is locked
I did this right after I restarted my computer.
When I use the Enterprise Manager at:
http://localhost:5500/em/
I get for ORCL:
Status: Status Pending
Status Pending Since: Unavailable
Seems that I can never get the database started properly?! When I press the Startup/Shutdown button I get:
Current Status: open
This is the correct current database status, although it doesnot match the current status in the sitemap page
What does this mean? Do you think this may contain the clue to the answer to this problem?
When I restart the Database I get the same status: unavailable.
I need your help to resolve this problem. The alternative is to revert back to Oracle 9i DB Server. Thank you in advance.
gkkI can help you with the SCOTT account being locked. Try:
sqlplus /nolog
connect / as sysdba
alter user scott identified by tiger account unlock; -
Is it possible to install Oracle 10g database on a linux Os ?
Hello all,
I recently installed Fedora 14, and oracle 10g free edition, on my modest laptop.
Problem is , I can't upload any scripts, because as i recently learnt from my school teacher, Oracle only works smoothly with Internet explorer browser (i.e.).
I tried using programs like winetricks to download a linux version of i.e. but in this case Oracle doesn't even open its homepage.
-In a nutshell, does anyone know a possible way to work with oracle 10g , (or any alternative), that's fully functional on linux (fedora 14) ? Download, Install steps,etc.
All i need to do is upload simple SQL scripts, and practice my " select from...." commands.
-Is oracle linux a option ? and what is it?
Thank you already for any replies, I'm really getting tired of googling threw different forums.865504 wrote:
Ed,
-i knew my teacher was being stubborn;
-I meant that the winetricks version of i.e., didn't open the homepage of oracle 10g (=log in screen).
-what i was trying to do was, after having installed oracle 10g , "go to data base homepage" (openend by firefox) , once logged in with my username, upload a script , and practice typing the different (select from ...group by..etc) sql commands.
Here is one of several concepts you need to fix in your mind. Databases don't have home pages. Client applications do. Databases store and manage data. Humans at the keyboard see the client application, not the database. Oracle provides some client apps ( iSQLPlus, Oracle Enterprise Manager (Grid Control), dbcontrol, APEX) and even installs some with the database by default, but they are distinctly separate from the database, and so must be identified when talking about user interface issues. Unfortunately, telling us you tried to open "the home page of oracle" tells us nothing at all. If you had said "Tried to log in with iSQLPlus" or "I tried to connect with Apex", it would have conveyed MUCH more information. We would have then had some frame of reference as to what you were seeing.
To the "upload from where" question : I simply copied the scripts ( .sql , file) from the pc's from school, on usb, then copied them on my own system. When using the "upload scripts" option from oracle, Again, you must distinguish between "oracle" (the database) and whatever client tool you use to connect to it. "Oracle" (the database) doesn't have an "upload scripts" option. Some un-named application does.
the script is uploaded, but when i try to "run" it , nothing , blank page. no tables, nada. And given what I've said above, you can guess what this statement means. - grin -
My first guess was, well the teacher said " i.e. only " , so i tried installing i.e. , using winetricks, but i had a feeling i was going off-track, and that surely there must have been a much easier way.
Even Billy was more charitable toward your teacher than I feel. And when he is so wrong about something as simple as this, makes me wonder what else he is wrong about. And the quality of the teachers calls into question the quality of the school in general.
In fact, had I been told that by an instructor, I would make it a personal mission to prove him wrong. Not in front of the class (as much short term satisfaction as that may provide) but just by taking my laptop to his office and saying "let me show you something". One of my personal hot buttons is for someone who should know better to pronounce something as "won't work" when I've been doing it for so long and so easily as to just take it for granted.
>
Linux (fedora 14) is up and running,
oracle 10g , linux version, was installed using detailed guide.
And yes, i will look into oracle linux, and oracle 11g ,
but i was hoping to use the same version as my school, to avoid any surprises when passing my exams.Edited by: EdStevens on Jun 13, 2011 3:02 PM -
Procedure execution time difference in Oacle 9i and Oracle 10g
Hi,
My procedure is taking time on
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 is 14 min.
same procedure is taking time on oracle Release 9.2.0.1.0 is 1 min.
1) Data is same in both environment.
2) Number of records are same 485 rows for cursor select statement.
3)Please guide me how to reduce the time in oracle 10g for procedure?
i have checked the explain plan for that cursor query it is different in both enviroment.
so i have analysis that procedure is taking time on cursor fetch into statement in oracle 10g.
example:-
create or replace procedure myproc
CURSOR cur_list
IS select num
from tbl
where exist(select.......
EXECUTE IMMEDIATE 'ALTER SESSION SET SQL_TRACE = TRUE';
EXECUTE IMMEDIATE 'ALTER SESSION SET TIMED_STATISTICS = TRUE';
OPEN cur_list;
LOOP
FETCH cur_list INTO cur_list; -----My procedure is taking time in this statement only for some list number. there are 485 list number.
end loop;
TRACE file for oracle 10g is look like this:-
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.37 0.46 0 2 0 0
Fetch 486 747.07 730.14 1340 56500700 0 485
total 488 747.45 730.60 1340 56500702 0 485
ORACLE 9i EXPLAIN PLAN FOR cursor query:-
Plan
SELECT STATEMENT CHOOSECost: 2 Bytes: 144 Cardinality: 12
18 INDEX RANGE SCAN UNIQUE LISL.LISL_LIST_PK Cost: 2 Bytes: 144 Cardinality: 12
17 UNION-ALL
2 FILTER
1 TABLE ACCESS FULL SLD.P Cost: 12 Bytes: 36 Cardinality: 1
16 NESTED LOOPS Cost: 171 Bytes: 141 Cardinality: 1
11 NESTED LOOPS Cost: 169 Bytes: 94 Cardinality: 1
8 NESTED LOOPS Cost: 168 Bytes: 78 Cardinality: 1
6 NESTED LOOPS Cost: 168 Bytes: 62 Cardinality: 1
4 TABLE ACCESS BY INDEX ROWID SLD.L Cost: 168 Bytes: 49 Cardinality: 1
3 INDEX RANGE SCAN UNIQUE SLD.PK_L Cost: 162 Cardinality: 9
5 INDEX UNIQUE SCAN UNIQUE SLD.SYS_C0025717 Bytes: 45,760 Cardinality: 3,520
7 INDEX UNIQUE SCAN UNIQUE SLD.PRP Bytes: 63,904 Cardinality: 3,994
10 TABLE ACCESS BY INDEX ROWID SLD.P Cost: 1 Bytes: 10,480 Cardinality: 655
9 INDEX UNIQUE SCAN UNIQUE SLD.PK_P Cardinality: 9
15 TABLE ACCESS BY INDEX ROWID SLD.GRP_E Cost: 2 Bytes: 9,447 Cardinality: 201
14 INDEX UNIQUE SCAN UNIQUE SLD.PRP_E Cost: 1 Cardinality: 29
13 TABLE ACCESS BY INDEX ROWID SLD.E Cost: 2 Bytes: 16 Cardinality: 1
12 INDEX UNIQUE SCAN UNIQUE SLD.SYS_C0025717 Cost: 1 Cardinality: 14,078
ORACLE 10G EXPLAIN PLAN FOR cursor query:-
SELECT STATEMENT ALL_ROWSCost: 206,103 Bytes: 12 Cardinality: 1
18 FILTER
1 INDEX FAST FULL SCAN INDEX (UNIQUE) LISL.LISL_LIST_PK Cost: 2 Bytes: 8,232 Cardinality: 686
17 UNION-ALL
3 FILTER
2 TABLE ACCESS FULL TABLE SLD.P Cost: 26 Bytes: 72 Cardinality: 2
16 NESTED LOOPS Cost: 574 Bytes: 157 Cardinality: 1
14 NESTED LOOPS Cost: 574 Bytes: 141 Cardinality: 1
12 NESTED LOOPS Cost: 574 Bytes: 128 Cardinality: 1
9 NESTED LOOPS Cost: 573 Bytes: 112 Cardinality: 1
6 HASH JOIN RIGHT SEMI Cost: 563 Bytes: 315 Cardinality: 5
4 TABLE ACCESS FULL TABLE SLD.E Cost: 80 Bytes: 223,120 Cardinality: 13,945
5 TABLE ACCESS FULL TABLE SLD.GRP_E Cost: 481 Bytes: 3,238,582 Cardinality: 68,906
8 TABLE ACCESS BY INDEX ROWID TABLE SLD.L Cost: 2 Bytes: 49 Cardinality: 1
7 INDEX UNIQUE SCAN INDEX (UNIQUE) SLD.PK_L Cost: 1 Cardinality: 1
11 TABLE ACCESS BY INDEX ROWID TABLE SLD.P Cost: 1 Bytes: 16 Cardinality: 1
10 INDEX UNIQUE SCAN INDEX (UNIQUE) SLD.PK_P Cost: 0 Cardinality: 1
13 INDEX UNIQUE SCAN INDEX (UNIQUE) SLD.SYS_C0011870 Cost: 0 Bytes: 13 Cardinality: 1
15 INDEX UNIQUE SCAN INDEX (UNIQUE) SLD.PRP Cost: 0 Bytes: 16 Cardinality: 1
so Please guide me how to reduce the time in oracle 10g for procedure?
1) Is this envrionment setting parameter?
2) I have to tune the query? but which is executing fine on oracle 9i?
so how to decrease the execution time?
Thanks in advance.SELECT l_nr
FROM x.ls b
WHERE b.cd = '01'
AND b.co_code = '001'
AND EXISTS (
SELECT T_L
FROM g.C
WHERE C_cd = '01'
AND C_co_code = '001'
AND C_flg = 'A'
AND C_eff_dt <= sysdate
AND C_end_dt >=
sysdate
AND C_type_code <> 1
AND C_type_code <> 1
AND targt_ls_type = 'C'
AND T_L <> 9999
AND T_L = b.l_nr
UNION ALL
SELECT l.T_L
FROM g.C C,
g.ep_e B,
g.ep ep,
g.e A,
g.lk_in l
WHERE l.cd = '01'
AND l.co_code = '001'
AND l.cd = C.C_cd
AND l.co_code = C.C_co_code
AND l.C_nbr = C.C_nbr
AND l.targt_ls_type = 'C'
AND lk_in_eff_dt <=
sysdate
AND lk_in_end_dt >=
( sysdate
+ 1
AND ( (logic_delte_flg = '0')
OR ( logic_delte_flg IN ('1', '3')
AND lk_in_eff_dt <> lk_in_end_dt
AND l.cd = ep.C_cd
AND l.co_code = ep.C_co_code
AND l.C_nbr = ep.C_nbr
AND l.ep_nbr = ep.ep_nbr
AND l.cd = A.e_cd
AND l.co_code = A.e_co_code
AND l.e_nbr = A.e_nbr
AND l.cd = B.cd
AND l.co_code = B.co_code
AND l.C_nbr = B.C_nbr
AND l.ep_nbr = B.ep_nbr
AND l.e_nbr = B.e_nbr
AND l.ep_e_rev_nbr = B.ep_e_rev_nbr
AND B.flg = 'A'
AND EXISTS (
SELECT A.e_nbr
FROM g.e A
WHERE A.e_cd = B.cd
AND A.e_co_code = B.co_code
AND A.e_nbr = B.e_nbr
AND A.e_type_code ^= 8)
AND C_type_code <> 10
AND C.C_type_code <> 13
AND l.T_L = b.l_nr)
--yes index is same -
Sqlj runtime error with oracle 10G in Websphere6 or 5.1
We are trying to migrate from oracle 9i to 10G and we are compiled all our sqlj code with codegen = -oracle option.(previously we used to use codegen=-jdbc which for some reason doesnot work).it compiles fine with out any erros.. But when we try to run then get this exception.
java.lang.IllegalArgumentException: SQLJ programs translated with the option -codegen=oracle must be run under Oracle JDBC 9.0.0 or higher. If the Oracle JDBC driver is wrapped, then the wrapper must implement all of the oracle.jdbc.OracleXxxx interfaces. Alternatively, you can translate SQLJ programs either with -codegen=iso. java.lang.IllegalArgumentException: SQLJ programs translated with the option -codegen=oracle must be run under Oracle JDBC 9.0.0 or higher. If the Oracle JDBC driver is wrapped, then the wrapper must implement all of the oracle.jdbc.OracleXxxx interfaces. Alternatively, you can translate SQLJ programs either with -codegen=iso.
at sqlj.runtime.ref.ConnectionContextImpl.getOracleConnection(ConnectionContextImpl.java:167)
at sqlj.runtime.ExecutionContext$OracleContext.prepareOracleStatement(ExecutionContext.java:1397)
We are using ojdbc14.jar that came with oracle 10G.
Hope any one can give any pointers.I'm having same issue - but I'm having it when I try to invoke a method that contains a database Object type from a Tibco Business Works Process called a Java Method.
How exactly do you do the codegen=iso configuration?
I've tried:
1. Project Properties / Compiler SQLJ and then select from Code Generation drop down iso.
2. From Connections / Database / Navigate to package / right-click / Generate Java / Browse to my custom jpub.properties file where I have tried multiple entries such as (by themselves and in some combination.:
- jpub.codegen=jdbc
- jpub.codegen=iso
- jpub.compatible=9i
- jpub.compatible=8i
- compatible=both8i
- jpub.usertypes=oracle
- jpub.compatible=customdatum
- jpub.compatible=sqlj
I've also played with changing from the default some of the Mapping Options in Connections / Database / Navigate to package / right-click / Generate Java / Mapping Options.
This doc here, says that code should change (section 6 JPublisher Input Files - based on configuration of Input files)
Oracle® Database
JPublisher User's Guide
10g Release 2 (10.2)
B14188-01
No matter what I do, the code that gets generate is the same.
Also, the documentation talks about running things from the command line but how exactly do you do that? Do I need to be in specific directory? I tried the c:\ C:\jdev\system and c\jdev\ and c:jdev\bin and always get error message: 'jpub' is not recognized as an internal or external command, operable program or batch file.
I've built a java client in JDeveloper to successfully call the same method and I don't see the error.
Edited by: disaak on Mar 9, 2010 11:51 AM
Maybe you are looking for
-
Multiple devices sharing one acct. iMessage gets tangled
how can my multiple devices use the same iTunes on PC, same purchashing on iTunes and not get the imessages and other icloud functions tangled between devices
-
Regarding use of java code inside javascript
Hi , I have doubt regarding how to use java code inside javascript, i am giving my application code here <%@page import="java.util.*"%> <%@ page import="com.suuny.sard.pmt.pat.*"%> <SCRIPT LANGUAGE="JavaScript"> function fun(){ var ac=document.l
-
Downloading a Specific Purchased Song??
I recently had a delete a lot of TV shows from my Library to clear up some space. I want to download one specific TV show that I purchased. It's no longer in my "Purchased" playlist. When I "Check for Purchases," it begins downloading the last thing
-
As if FCP-X wasn't buggy enough, HELP doesn't work either!
So I click on the Help menu and choose Final Cut Pro X Help. There, I get the search box, where I can type in a word or a phrase. I typed in the phrase I thought might reveal the Help items that might be of interest to me, and sure enough a list of
-
Am successfully using swfaddress and love it. For the first time though I'm trying to implement it on a site that has a load bar. The issue is if I use the browser's back button I'll eventually get to a page that just shows the full loadbar and sto