Oracle 10g Query Format
0
down vote
favorite I am using oracle 10g. I have a temp table TEMP.
TEMP has following structure:-
USER COUNT TYPE
1 10 T1
2 21 T2
3 45 T1
1 7 T1
I need a query which will show all types has column names,and types can be any value like T1,T2,..Tn and columns will be like:-
USER T1 T2 Tn
and User column will show all the users and T1,T2 column will show total count of types.
Edited by: 969468 on Nov 15, 2012 9:35 PM
Please see my original post ("I have a page erroring in production (but not in development) when it gets to a date that it needs to display.") Sorry if it came across as vague. It made sense, to me, when I typed it. But, then, I'm usually typing fast just to get the question out there, when I'm in a hurry.
Haven't done a CFDUMP, yet, as every time I make a change in development that needs to be tested in production, I have to notify my supervisor that there are files that need to be copied into production, which can sometimes take a while, so I try to do troubleshooting on dev side - it's a pain in the you-know-what, but that's the kind of environment I'm working in.
As it turns out, changing the format in the SELECT to_char() did the trick. If anyone else has this issue with Oracle 10g, I'm now using SELECT to_char(create_date,'YYYY/MM/DD HH:MI') FROM tableA, and now the CFOUTPUT is processing the whole page. I guess the MM-DD-YYYY threw CF into a tizzy, breaking the process?
Anyhoo, it's working, now. Thank you, Dan and Adam, for your thoughts on this.
^_^
Similar Messages
-
Oracle 10g - Date format in SELECT query for CFOUTPUT
Hello, everyone.
The project that I am working on in the dev environment is connected to an Oracle 11g database, but the production side is Oracle 10g.
I have a page that is erroring in production (but not development) when it gets to a date that it needs to display.
A co-worker mentioned that, in 10g, if a date/time is being SELECTed, you have to put it in to_char(), so I did that.
But it's still erroring, and I'm not getting an error message, so I'm assuming that I have an incorrect format for the date in the SELECT.
What is the proper format for SELECTing a date/time when using to_char()? Right now, I have SELECT to_char(create_date,'MM-DD-YYYY HH:MI') FROM tableA . Is this not correct for CF to output?
Thank you,
^_^Please see my original post ("I have a page erroring in production (but not in development) when it gets to a date that it needs to display.") Sorry if it came across as vague. It made sense, to me, when I typed it. But, then, I'm usually typing fast just to get the question out there, when I'm in a hurry.
Haven't done a CFDUMP, yet, as every time I make a change in development that needs to be tested in production, I have to notify my supervisor that there are files that need to be copied into production, which can sometimes take a while, so I try to do troubleshooting on dev side - it's a pain in the you-know-what, but that's the kind of environment I'm working in.
As it turns out, changing the format in the SELECT to_char() did the trick. If anyone else has this issue with Oracle 10g, I'm now using SELECT to_char(create_date,'YYYY/MM/DD HH:MI') FROM tableA, and now the CFOUTPUT is processing the whole page. I guess the MM-DD-YYYY threw CF into a tizzy, breaking the process?
Anyhoo, it's working, now. Thank you, Dan and Adam, for your thoughts on this.
^_^ -
Conversion of Mysql query in oracle acceptable query format
Hi
I have successfully converted my MySql database in oracle. Now the problem is how to execute already written hundreds of Mysql query on the oracle. There are many syntax variation in Mysql query format which is not acceptable for oracle.
For Example
Select case_id as 'this is alias' from cases
The above query can run on Mysql database but have problem while executing Oracle, because single quotes should be replaced with double quotes before executing it on oracle. There are also many other syntax conflicts.
I have tried to resolve the problem through SwisSQLAPI but problem still exist as SwisSQLAPI is not dealing with all syntax conflict. In my case (select if (expresion, true,false)) must be replace with decode (expression, value,true,false) function of oracle and this conversion is not supported by SwisSQLAPI.
Please help me in resolving this problem
ThanksThe problem with trying to port from one language (mysql SQL) to another (oracle SQL) is that there's generally no hard rules for a computer to follow, that it will get it 100% correct.
Look at babelfish when you translate a foreign language to English. The end result is readable (usually), but it's rarely completely correct.
The problem is when you feed something into Oracle SQL, it needs to be 100% correct.
All you can really do here is rewrite these queries. It shouldn't actually take as long as you think, because 50% of queries will generally need very minor changes you can do in a minute, and 25% won't need any changes at all. -
I have following queries to be solved please help me out....
1) Difference / Limitation of Oracle Standard Edition / Enterprise Edition 10..... latest ?
2) Can Data of Oracle 8. ..... Expo File will be Imported to 10....... latest ?
If not than what steps we have to take. Basically I would like my current DB of 8 to be moved to 10G
3) From which AIX Ver Oracle 10 ...... is Supported ?
4) if the customer has 8... Ver Lic When if goes for New Ver than media will have full Ver or only Upgrade files. ?
5) If the Customer has Old ver Lic and he goes for upgrade Lic Than we have to first Install Old Lic Ver & than Upgrade or directly we can load Latest Lic Ver on New Server and work. ? What I mean is if I have to go ahead from Oracle 8 to Oracle 10G how should I go about.
6) Is Oracle Media ver Compatible for Aix ?
7) Oracle Lic Policy / Product Information Web Link ?
Thanks & Regards
Shivanand S SThis is a perfectly valid way to query the data. Here's an example on my own production tables. This one has about 300 million rows:
select *
from prod.tran_history
where tran_date >= to_date(add_months(sysdate, -2))
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 11M| 863M| 146K|
| 1 | TABLE ACCESS BY INDEX ROWID| TRAN_HISTORY | 11M| 863M| 146K|
|* 2 | INDEX RANGE SCAN | TRAN_HIST_DATE_IDX | 2144K| | 2098 |
-------------------------------------------------------------------------------------------- -
Oracle 10g query rows to column transpose
In oracle 10g I have table called LoginUser
Select * from LoginUser where Day = '01-Dec-2012'
will give me the below result
Day, Name, Country
1-Dec-12 , John, UK
1-Dec12 , Cate, US
1-Dec-12 , Prakash, India
1-Dec-12 ,Juli, Pak
But I want result as below
Day, Name1, Country1, Name2, Country2, Name3, Country3, Name4, Country4
1-Dec-12, John, UK, Cate, US, Prakash, India, Juli, Pak
Please help
Edited by: 975340 on Dec 6, 2012 1:48 AM
Edited by: 975340 on Dec 6, 2012 1:50 AMRefer to below thread
Re: Multiple rows into a single line in 'Single Column Table' -
Oracle 10g - query is very slow in jdbc but not in other tools
I'm using PreparedStatement to execute a query with some parameters.
in sql developer, it just spends 12 seconds but in jdbc, it's around 140 seconds.
I disabled "_optim_peek_user_binds" parameter already but it didn't help.
alter session set "_optim_peek_user_binds"=false;Please mark this thread ANSWERED and repost it in the JDBC forum.
https://forums.oracle.com/forums/category.jspa?categoryID=288
When you post provide your 4 digit Oracle version, Java version and JDBC jar name and version as well as the code you are using. -
Oracle 10g Query on Date Column
Hello -
What is the most efficient way to query on a date column to get all dates within the last 2 months? I use something like the following in the WHERE clause:
billing_date >= to_date(add_months(sysdate, -2))
However, I can't ever get the index on billing_date to be used.
Any help is greatly appreciated...
Thanks!!This is a perfectly valid way to query the data. Here's an example on my own production tables. This one has about 300 million rows:
select *
from prod.tran_history
where tran_date >= to_date(add_months(sysdate, -2))
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 11M| 863M| 146K|
| 1 | TABLE ACCESS BY INDEX ROWID| TRAN_HISTORY | 11M| 863M| 146K|
|* 2 | INDEX RANGE SCAN | TRAN_HIST_DATE_IDX | 2144K| | 2098 |
-------------------------------------------------------------------------------------------- -
Selective export failing - Solaris Sparc - Oracle 10g
HI Gurus,
I am trying to export selective data from one of my prod database tables. But not succeeding. I was keep on trying for the past 2 hours.
Could anybody please verify the script and let me know what was wrong in it. Thanks in advance
OS : SOLARIS SPARC
ORACLE - 10G
Query --> WHERE E3RECV_DT LIKE '201305%' (I need to export this query data)
Below Script i am using
===============
exp E3USER@SGEBAPU2 statistics=none consistent=n buffer=100000000 file=exp_pipe_file TABLES=IFDATA query=\"WHERE E3RECV_DT LIKE '201305\%'\" log=PGTB_IFDATA_conditional.logNagaraju P wrote:
HI Gurus,
I am trying to export selective data from one of my prod database tables. But not succeeding. I was keep on trying for the past 2 hours.
Could anybody please verify the script and let me know what was wrong in it. Thanks in advance
OS : SOLARIS SPARC
ORACLE - 10G
Query --> WHERE E3RECV_DT LIKE '201305%' (I need to export this query data)
Below Script i am using
===============
exp E3USER@SGEBAPU2 statistics=none consistent=n buffer=100000000 file=exp_pipe_file TABLES=IFDATA query=\"WHERE E3RECV_DT LIKE '201305\%'\" log=PGTB_IFDATA_conditional.logconsider placing everything on Control file to avoid fighting with the command line interpreter.
my car is not succeeding.
Tell me how to make my car go.
use COPY & PASTE so we can see what you do & exactly how Oracle responds.
How do I ask a question on the forums?
SQL and PL/SQL FAQ -
How to run a report from oracle 10g form in .csv format
dear all,
how to run a report from oracle 10g form in .csv format? i've already run in pdf & excel format.
i'm using
SET_REPORT_OBJECT_PROPERTY (ro_report_id, report_desformat, 'PDF'); --for pdf
SET_REPORT_OBJECT_PROPERTY (ro_report_id, report_desformat, 'SPREADSHEET'); ---for excel
Please Help..i have already tried.
but the report show in htm or html format. that file will not save into csv. please help. -
Hi,
I have a query with regards to Oracle 10g licensing for additional options (OLAP, Data Mining, Partitioning, Spatial & Database Vault) on top of enterprise edition.
Even though i am not using any of the options, i have them installed along with enterprise edition. Do i still need to pay for these additional options?
From 10g, you can always prove to oracle that any of the features/options are not in use via DBA_FEATURE_USAGE_STATISTICS.
We are using shared infrastructure for hosting many application databases. Today we have a application that uses only partitioning, but tommorrow we might have to create a database within the same oracle home that uses OLAP & data mining as well.
would be interested in knowing what is oracle stand on this i.e. we pay for additional options only if we are using them or we pay just because they are installed regardless of we are using them or not??
Thanks & Regards
ChandarChandark,
You need to pay licenses if you are using it commercially and if it is installed and you haven't paid for it then how would you stop anyone not using it because its not paid but its there. This will be against your contractual agreement and they may fine you or you have to pay for the options. So I recommend not to install options you haven't paid for to avoid any issues. But if you are using for learning purpose and not commercial then you are good. You can further contact local Oracle Support or local Sales rep for more information
Hope this helps, regards
OrionNet -
Issue with "Select Distinct" query in Oracle 10g against Oracle 9i
Hi,
I would appreciate if some one help me here because it is really urgent.
We are upgrading our database from 9i to 10g.
There are the "Select distinct" queries in the code which populated the grid on the applications screens. We found a difference in 9i and 10g the way the result is populated for these queries. If "Select Distinct" query wihtout a order by clause is executed in 9i then the result is automatically sorted. But Oracle 10g does not do this.
We can change the queries adding order by clause but we are almost at the end of the testing and want to know if there is any way that we can do this from database settings. Would there be any impact of these settings change on overall operation of Oracle 10g?
I would appreciate if some one can help me here.
Thanks,
Dineshthen the result is automatically sorted.No. Oracle may have done a sort operation to perform the distinct, but it still did not guarantee the order of your results.
In 10g and in 9i, if you want your results in a certain order you must use order by. -
Query can run in Oracle 10g but very slow in 11g
Hi,
We've just migrated to Oracle 11g and we noticed that some of our view are very slow (it takes seconds in 10g and takes 30 minutes in 11g), and the tables are using the local table.
Do any of you face the same issue?
This is our query:
SELECT
A.wellbore
,a.depth center
,d.MD maxbc
,d.XDELT xbc
,d.YDELT ybc
,e.MD minac
,e.XDELT xac
,e.YDELT yac
from
table_A d,table_A e, table_B a
where a.wellbore = d.WELLBORE (+)
and a.wellbore = e.WELLBORE(+)
and d.MD = (select max(MD) from table_A b where b.MD < a.depth and
d.wellBORE = b.wellBORE)
and e.md = (select min(md) from table_A c where c.MD > a.depth and
e.wellBORE = c.wellBORE);Thanks I will move to the correct one..
Rafi,
Build the Indexes and it is still slow. I am querying from a view from another database, which is in 10g instances.
Moved: Query can run in Oracle 10g but very slow in 11g
Edited by: 924400 on Apr 1, 2012 6:03 PM
Edited by: 924400 on Apr 1, 2012 6:26 PM -
Query working fine in 9i but throwing an error in Oracle 10g
Hi All,
I am having a query which contains large number of When clauses inside a case statement.
The Same SQL is working fine in 9i, but not working in 10G.
If we try to remove one of the When clause in the query, its working fine else it is giving the error ORA-00939 Too many arguments for functions.
Can any one tell me the solution for this and what is the maximum number of when clauses allowed inside case statemen in oracle 10g.
Thanks in advance
Regards
Karthikit should not have worked in 9iR2... it is correct according to the doc to return an error message when using more than 255 expressions...
SQL> select version from v$instance;
VERSION
9.2.0.7.0
SQL> select case 1
2 when 2 then 3
3 when 4 then 5
4 when 6 then 7
5 when 8 then 9
6 when 10 then 11
7 when 12 then 13
8 when 14 then 15
9 when 16 then 17
10 when 18 then 19
11 when 20 then 21
12 when 22 then 23
13 when 24 then 25
14 when 26 then 27
15 when 28 then 29
16 when 30 then 31
17 when 32 then 33
18 when 34 then 35
19 when 36 then 37
20 when 38 then 39
21 when 40 then 41
22 when 42 then 43
23 when 44 then 45
24 when 46 then 47
25 when 48 then 49
26 when 50 then 51
27 when 52 then 53
28 when 54 then 55
29 when 56 then 57
30 when 58 then 59
31 when 60 then 61
32 when 62 then 63
33 when 64 then 65
34 when 66 then 67
35 when 68 then 69
36 when 70 then 71
37 when 72 then 73
38 when 74 then 75
39 when 76 then 77
40 when 78 then 79
41 when 80 then 81
42 when 82 then 83
43 when 84 then 85
44 when 86 then 87
45 when 88 then 89
46 when 90 then 91
47 when 92 then 93
48 when 94 then 95
49 when 96 then 97
50 when 98 then 99
51 when 100 then 101
52 when 102 then 103
53 when 104 then 105
54 when 106 then 107
55 when 108 then 109
56 when 110 then 111
57 when 112 then 113
58 when 114 then 115
59 when 116 then 117
60 when 118 then 119
61 when 120 then 121
62 when 122 then 123
63 when 124 then 125
64 when 126 then 127
65 when 128 then 129
66 when 130 then 131
67 when 132 then 133
68 when 134 then 135
69 when 136 then 137
70 when 138 then 139
71 when 140 then 141
72 when 142 then 143
73 when 144 then 145
74 when 146 then 147
75 when 148 then 149
76 when 150 then 151
77 when 152 then 153
78 when 154 then 155
79 when 156 then 157
80 when 158 then 159
81 when 160 then 161
82 when 162 then 163
83 when 164 then 165
84 when 166 then 167
85 when 168 then 169
86 when 170 then 171
87 when 172 then 173
88 when 174 then 175
89 when 176 then 177
90 when 178 then 179
91 when 180 then 181
92 when 182 then 183
93 when 184 then 185
94 when 186 then 187
95 when 188 then 189
96 when 190 then 191
97 when 192 then 193
98 when 194 then 195
99 when 196 then 197
100 when 198 then 199
101 when 200 then 201
102 when 202 then 203
103 when 204 then 205
104 when 206 then 207
105 when 208 then 209
106 when 210 then 211
107 when 212 then 213
108 when 214 then 215
109 when 216 then 217
110 when 218 then 219
111 when 220 then 221
112 when 222 then 223
113 when 224 then 225
114 when 226 then 227
115 when 228 then 229
116 when 230 then 231
117 when 232 then 233
118 when 234 then 235
119 when 236 then 237
120 when 238 then 239
121 when 240 then 241
122 when 242 then 243
123 when 244 then 245
124 when 246 then 247
125 when 248 then 249
126 when 250 then 251
127 when 252 then 253
128 when 254 then 255
129 when 256 then 257
130 end x from dual;
X
SQL> select version from v$instance;
VERSION
10.2.0.2.0
SQL> select case 1
2 when 2 then 3
3 when 4 then 5
4 when 6 then 7
5 when 8 then 9
6 when 10 then 11
7 when 12 then 13
8 when 14 then 15
9 when 16 then 17
10 when 18 then 19
11 when 20 then 21
12 when 22 then 23
13 when 24 then 25
14 when 26 then 27
15 when 28 then 29
16 when 30 then 31
17 when 32 then 33
18 when 34 then 35
19 when 36 then 37
20 when 38 then 39
21 when 40 then 41
22 when 42 then 43
23 when 44 then 45
24 when 46 then 47
25 when 48 then 49
26 when 50 then 51
27 when 52 then 53
28 when 54 then 55
29 when 56 then 57
30 when 58 then 59
31 when 60 then 61
32 when 62 then 63
33 when 64 then 65
34 when 66 then 67
35 when 68 then 69
36 when 70 then 71
37 when 72 then 73
38 when 74 then 75
39 when 76 then 77
40 when 78 then 79
41 when 80 then 81
42 when 82 then 83
43 when 84 then 85
44 when 86 then 87
45 when 88 then 89
46 when 90 then 91
47 when 92 then 93
48 when 94 then 95
49 when 96 then 97
50 when 98 then 99
51 when 100 then 101
52 when 102 then 103
53 when 104 then 105
54 when 106 then 107
55 when 108 then 109
56 when 110 then 111
57 when 112 then 113
58 when 114 then 115
59 when 116 then 117
60 when 118 then 119
61 when 120 then 121
62 when 122 then 123
63 when 124 then 125
64 when 126 then 127
65 when 128 then 129
66 when 130 then 131
67 when 132 then 133
68 when 134 then 135
69 when 136 then 137
70 when 138 then 139
71 when 140 then 141
72 when 142 then 143
73 when 144 then 145
74 when 146 then 147
75 when 148 then 149
76 when 150 then 151
77 when 152 then 153
78 when 154 then 155
79 when 156 then 157
80 when 158 then 159
81 when 160 then 161
82 when 162 then 163
83 when 164 then 165
84 when 166 then 167
85 when 168 then 169
86 when 170 then 171
87 when 172 then 173
88 when 174 then 175
89 when 176 then 177
90 when 178 then 179
91 when 180 then 181
92 when 182 then 183
93 when 184 then 185
94 when 186 then 187
95 when 188 then 189
96 when 190 then 191
97 when 192 then 193
98 when 194 then 195
99 when 196 then 197
100 when 198 then 199
101 when 200 then 201
102 when 202 then 203
103 when 204 then 205
104 when 206 then 207
105 when 208 then 209
106 when 210 then 211
107 when 212 then 213
108 when 214 then 215
109 when 216 then 217
110 when 218 then 219
111 when 220 then 221
112 when 222 then 223
113 when 224 then 225
114 when 226 then 227
115 when 228 then 229
116 when 230 then 231
117 when 232 then 233
118 when 234 then 235
119 when 236 then 237
120 when 238 then 239
121 when 240 then 241
122 when 242 then 243
123 when 244 then 245
124 when 246 then 247
125 when 248 then 249
126 when 250 then 251
127 when 252 then 253
128 when 254 then 255
129 when 256 then 257
130 end x from dual;
when 16 then 17
ERROR at line 9:
ORA-00939: too many arguments for function
SQL> del 129
SQL> /
X
---------- -
Query works on Oracle 9i, but fails on Oracle 10g - puzzling...
In porting an application from Oracle 9i to Oracle 10g, I hit a problem that for a while I assumed was some bug of mine. But I eventually isolated the problem and can reproduce this using a single sql script and then a single delete. The amazing thing is that it works fine on Oracle 9i (always) and fails on Oracle 10g (always).
Have I found a bug? (I would be pretty amazed).
Here's the situation. I have four tables and a trigger set on one of those tables.
The tables are configured so that there is the "parent" table (A). Table B has a foreign key dependency on A's primary key, with "on delete cascade". Table B also has a trigger that runs on the delete. Table C (which has no data) has an integrity constraint on A's primary key. Table D holds information used by the trigger to determine if/when table C should be dropped. (I have a script that sets all this up).
After setting up the tables and the few data records needed, I delete a record from Table A. This causes the records in Table B to be deleted. That fires the trigger, which determines that Table C can be dropped, so the trigger drops Table C. Then, Oracle decides it still needs to check the integrity constraint on Table C (after all, C depended on A and we have deleted a record in A). Oracle then issues a query against table C, but of course table C has already been dropped and an error results.
The exact same script followed by the delete works fine on Oracle 9i. Is this a bug or is this a documented change in behavior? Any known workarounds? Unfortunately, the application needs all the integrity constraints that are present in the schema and also runs on SQL Server, so modifications in the integrity constraints are probably not what I am seeking).
Thanks so much!
RBI wasn't sure how to post the script, but it is short enough to include below. Many thanks for the quick response.
To connect the script below to my original post, the names are:
Table A = OT_AW_PROCESSDEF
Table B = OT_AW_PROCESS_APPDATADEF
Table C = OT_AW_AD_OneLoop_1
Table D = OT_AW_APPDATA_TABLEINFO
The trigger is also included in the script. After running this script, the command:
delete from OT_AW_ProcessDef where processdefId = 101
will cause the failure on Oracle10g, but succeeds on Oracle 9i.
Thanks again!
RB
/* *********************** CLEAN UP ********************************** */
/* Order the dropping of objects in reverse of creation */
DROP TABLE OT_AW_AD_OneLoop_1 CASCADE CONSTRAINTS
DROP TABLE OT_AW_PROCESS_APPDATADEF CASCADE CONSTRAINTS
DROP TABLE OT_AW_APPDATA_TABLEINFO CASCADE CONSTRAINTS
DROP TABLE OT_AW_PROCESSDEF CASCADE CONSTRAINTS
/* ******************* DATA TABLES *********************************** */
/* OT_AW_PROCESSDEF(Process Definition) Table */
/* ********** NOTE: OT_AW_PROCESSDEF and AW_PROCESS TABLES SHOULD ALWAYS HAVE THE SAME SET OF COLUMNS ********* */
create table OT_AW_PROCESSDEF (
processDefId NUMBER /* Id for the process definition */
, processDefName NVARCHAR2(255) /* Name of the process definition */
, CONSTRAINT OT_AW_PROCESSDEF_PK PRIMARY KEY(processDefId)
insert into OT_AW_PROCESSDEF (
processDefId, processDefName
values (
1, 'ADHOC'
/* OT_AW_APPDATA_TABLEINFO(List of all application Data tables in the system) Table */
create table OT_AW_APPDATA_TABLEINFO (
namespace VARCHAR2(65) NOT NULL, /* name of the namespace to which it belongs */
tableName VARCHAR2(128) , /* Name of the appdata table */
adLevel NUMBER(38) NOT NULL /* Appdata table level: 0=>PROCESS, 1=>CONVERSATION */
, CONSTRAINT OT_AW_APPDATA_TABLEINFO_PK PRIMARY KEY ( tableName )
, CONSTRAINT OT_AW_APPDATA_TABLEINFO_UNQ UNIQUE( namespace, tableName, adLevel )
/* OT_AW_PROCESS_APPDATADEF(Process level application data definition) Table */
create table OT_AW_PROCESS_APPDATADEF (
processDefId NUMBER NOT NULL /* Id for the process definition */
, name VARCHAR2(65) NOT NULL /* Name of the application data field, This name may be pointing to a shared namespace field */
, tableName VARCHAR2(128) /* Name of the table that holds the value for the field, may be same as local namespace table name */
, namespace VARCHAR2(65) NOT NULL /* Name of the namespace to which this field belongs */
, mappedNamespace VARCHAR2(65) null /* Name of the shared namespace to which this field is mapped, if there is any mapping */
, CONSTRAINT OT_AW_PROCESS_APPDATADEF_PK PRIMARY KEY (namespace, processDefId, name)
, CONSTRAINT OT_AW_PROCESS_APPDATADEF_FK FOREIGN KEY (processDefId) REFERENCES OT_AW_PROCESSDEF(processDefId) on delete cascade
CREATE TABLE OT_AW_AD_OneLoop_1(processDefId number , processId number ,FromRole number null, ToRole number null, Anyone number null,
CONSTRAINT OT_AW_AD_OneLoop_1_FK1 FOREIGN KEY (processDefId) REFERENCES OT_AW_PROCESSDEF(processDefId) )
/* TRIGGERS */
CREATE OR REPLACE TRIGGER OT_AW_PROCESS_APPDATADEF_DEL
AFTER DELETE ON OT_AW_PROCESS_APPDATADEF
FOR EACH ROW
DECLARE
PRAGMA AUTONOMOUS_TRANSACTION;
tableName_var OT_AW_PROCESS_APPDATADEF.tableName%TYPE;
tempStr_var varchar2(128) :=null;
deletedId OT_AW_PROCESS_APPDATADEF.processDefId%TYPE;
deletedMNsp OT_AW_PROCESS_APPDATADEF.mappedNamespace%TYPE;
numReferences number :=-1;
tableExists number :=0;
CURSOR ADPTable_cursor
IS
SELECT apa.tableName, apa.processDefId, apa.mappedNamespace
FROM OT_AW_PROCESS_APPDATADEF apa
WHERE apa.tableName = :old.tableName
AND apa.processDefId = :old.processDefId;
BEGIN
dbms_output.put_line('Starting TRIGGER OT_AW_PROCESS_APPDATADEF_DEL');
OPEN ADPTable_cursor;
LOOP
FETCH ADPTable_cursor
INTO tableName_var, deletedId, deletedMNsp;
EXIT WHEN ADPTable_cursor%NOTFOUND;
BEGIN
IF (deletedMNsp IS NULL) THEN
BEGIN
select count(*) into numReferences from OT_AW_PROCESS_APPDATADEF where tableName = tableName_var
and processDefId <> deletedId;
IF ( numReferences = 0 ) THEN
BEGIN
SELECT count(*) INTO tableExists FROM OT_AW_APPDATA_TABLEINFO where
tableName=tableName_var;
IF (tableExists > 0) THEN
BEGIN
--dbms_output.put_line('About to alter first table');
-- EXECUTE IMMEDIATE 'ALTER TABLE ' || tableName_var || ' DROP CONSTRAINT ' || tableName_var ||'_FK1';
--dbms_output.put_line('About to alter second table');
-- EXECUTE IMMEDIATE 'ALTER TABLE ' || tableName_var || ' DROP CONSTRAINT ' || tableName_var ||'_FK2';
dbms_output.put_line('About to drop table named: ' || tableName_var);
tempStr_var := 'DROP TABLE ' || tableName_var;
EXECUTE IMMEDIATE tempStr_var;
dbms_output.put_line(tempStr_var);
dbms_output.put_line('Table dropped');
--dbms_output.put_line('Not dropping table now');
END;
END IF;
delete from OT_AW_APPDATA_TABLEINFO where
tableName=tableName_var;
dbms_output.put_line('OT_AW_APPDATA_TABLEINFO updated');
END;
END IF;
END;
END IF;
END;
END LOOP;
dbms_output.put_line('Loop ended');
CLOSE ADPTable_cursor;
dbms_output.put_line('Cursor closed');
COMMIT WORK;
dbms_output.put_line('Work committed');
dbms_output.put_line('Ending TRIGGER OT_AW_PROCESS_APPDATADEF_DEL');
END;
show errors;
/* Set up data to simulate the creation of OT_AW_AD_OneLoop_1 */
insert into OT_AW_PROCESSDEF (
processDefId, processDefName
values (
101, 'OneLoop'
insert into OT_AW_PROCESS_APPDATADEF (
processDefId, name, tableName, namespace
values (
101, 'FromRole', 'OT_AW_AD_OneLoop_1', 'OneLoop'
insert into OT_AW_PROCESS_APPDATADEF (
processDefId, name, tableName, namespace
values (
101, 'ToRole', 'OT_AW_AD_OneLoop_1', 'OneLoop'
insert into OT_AW_APPDATA_TABLEINFO (
namespace, tablename, adlevel
values (
'OneLoop', 'OT_AW_AD_OneLoop_1', 0
/ -
I'm using Oracle 10g XE on Windows Vista and I'm curious as to what determines the date format.
According to the globalization section in the Oracle installation guide the NLS_DATE format is dependent on the NLS_LANGUAGE setting. In my database the NLS_LANGUAGE is American, the NLS_TERITORY is America and all other NLS_* parameters are blank (default).
From that I would expect the default date format to be mon-dd-yyyy.
However when I run SELECT sysdate FROM dual the date is reported as dd/mm/yyyy and this was the default format when I used SQL Developer and when I used the command line SQL*Plus. Obviously something else is determining the date format, but what?Your settings are dependent on NLS_LANG on the client.
They are derived from (assuming Windows) the regional settings of the O/S.
This means in Western Europe the default 'American_America.WE8MSWIN1252'.
This makes the default NLS_DATE_FORMAT dd-mm-yy.
You can override this in the registry, or set up an after logon trigger.
Sybrand Bakker
Senior Oracle DBA
Maybe you are looking for
-
Problem with .fla file opening in FC 5.5
Hello. I'm fresh Flash Catalyst 5.5 user and I suppose I do something wrong. I tried to open .fla template simply by double-clicking it, but it is not recognized. Then I tried to rightclick on it and choose 'open file with', but when I choose FC 5.5
-
Non-hex character in hex string after upgrade to Yosemite
Hi, When I try to open some of my files I get an error: "Acrobat PDF File Format is having difficulties. Non-hex character in a hex string". I could open the files before. The only thing I've done since I opened the file last was to upgrade to Yosemi
-
INTERVAL in Range Partition?
Hi All, In Teradata, we have one option named INTERVAL which helps to define the interval at which we want the range partition to work. In HANA, I see that we have to mention all the dates respectively for each partition. Do you know if there any opt
-
Coding language for SRM & information required about Japanese auction
Hi , Kindly let me know the programming language for SRM and in particular about the auctioning module of SRM. Also can we customise the code to provide japanese auction in SRM or auctioning module. Thanks
-
Hello, I've just created a new Instant Portal, and I am following the instructions on creating a user that only has access to it. I create a user using the instant portal user tool, then I go to Administer and set that page as the users default page.