Comments on: Disappearing Columns https://technology.amis.nl/2006/12/19/disappearing-columns/ Friends of Oracle and Java Sat, 01 Aug 2015 11:10:05 +0000 hourly 1 http://wordpress.org/?v=4.2.3 By: Remco Blaakmeer https://technology.amis.nl/2006/12/19/disappearing-columns/#comment-4178 Thu, 24 Jun 2010 00:06:02 +0000 http://technology.amis.nl/blog/?p=1444#comment-4178 Alex,
I just thought of a solution to this problem, with this trigger:
 
create or replace trigger trg_prevent_create_xmltype
before create
on database
begin
if ora_dict_obj_owner != ‘SYS’
and upper(ora_dict_obj_name) = ‘XMLTYPE’
then
raise_application_error(-20000, ‘Will not create XMLTYPE (ignore this error)’);
end if;
end;
/
 
This generates an error when you forget to strip the CREATE TYPE statement. This might not be what you want if you execute the DDL from the Design Editor, but I don’t do that anyway.
 

]]>
By: Alex Nuijten https://technology.amis.nl/2006/12/19/disappearing-columns/#comment-4177 Mon, 29 Jan 2007 12:32:31 +0000 http://technology.amis.nl/blog/?p=1444#comment-4177 Hi Rachana,
No that is not possible. I can see any praticle use for it either….

SQL>
SQL> set serveroutput on
SQL> begin
2 dbms_output.put_line (sqlerrm (-12983));
3 end;
4 /
ORA-12983: cannot drop all columns in a table

PL/SQL procedure successfully completed.

SQL>

]]>
By: Rachana https://technology.amis.nl/2006/12/19/disappearing-columns/#comment-4176 Mon, 29 Jan 2007 05:59:27 +0000 http://technology.amis.nl/blog/?p=1444#comment-4176 Can we drop all the columns in a table at a time ????????

]]>
By: Marco Gralike https://technology.amis.nl/2006/12/19/disappearing-columns/#comment-4175 Sat, 23 Dec 2006 17:08:09 +0000 http://technology.amis.nl/blog/?p=1444#comment-4175 Bug, SR has been accepted by Oracle on all levels (not only the one shown here). I (but you triggered me, Alex) refer to this one, as my newly discovered (SQL) “Database Injection” bug (because it HAS some security implications, if you think about it…), and is not only data corruption related.

Alex, Harm, follow up can be read the SR via the BetaCSI

]]>
By: harm https://technology.amis.nl/2006/12/19/disappearing-columns/#comment-4174 Fri, 22 Dec 2006 12:08:16 +0000 http://technology.amis.nl/blog/?p=1444#comment-4174 Although not predefined in Designer, it HAS support for xmltype. You have to create the type yourself as TYPE object. After that you can reference to it in your tables and views and program units.

]]>
By: Alex Nuijten https://technology.amis.nl/2006/12/19/disappearing-columns/#comment-4173 Thu, 21 Dec 2006 09:13:58 +0000 http://technology.amis.nl/blog/?p=1444#comment-4173 Ah, good point…. you were miles ahead of me, now I understand what you mean. Thank you.

]]>
By: Marco Gralike https://technology.amis.nl/2006/12/19/disappearing-columns/#comment-4172 Wed, 20 Dec 2006 20:58:15 +0000 http://technology.amis.nl/blog/?p=1444#comment-4172 My problem is that it should behave as the following DATE contra XMLTYPE example… (in which the DATE behavior is the recommended one…)

To show that it shouldn’t be happening or it is at least inconsistent behavior, two examples: one with “XMLTYPE” and one with “DATE”…

SQL> CREATE OR REPLACE TYPE MYDATE AS OBJECT
2 (X INT
3 )
4 /

Type created.

SQL> drop type mydate;

Type dropped.

SQL> CREATE OR REPLACE TYPE DATE AS OBJECT
2 (X INT
3 )
4 /
CREATE OR REPLACE TYPE DATE AS OBJECT
*
ERROR at line 1:
ORA-02302: invalid or missing type name

SQL> CREATE OR REPLACE TYPE XMLTYPE AS OBJECT
2 (X INT
3 )
4 /

Type created.

SQL> show user
USER is “SYSTEM”

]]>
By: Alex Nuijten https://technology.amis.nl/2006/12/19/disappearing-columns/#comment-4171 Wed, 20 Dec 2006 15:00:10 +0000 http://technology.amis.nl/blog/?p=1444#comment-4171 How very true and how very sad. Still there are lots of companies who use Designer and rely heavily upon it.
In September 2004, we had a session about the future of Designer. Here is the link to that session: http://technology.amis.nl/blog/?p=164

]]>
By: Michael Friedman https://technology.amis.nl/2006/12/19/disappearing-columns/#comment-4170 Wed, 20 Dec 2006 14:33:02 +0000 http://technology.amis.nl/blog/?p=1444#comment-4170 The real problem is that Oracle is not doing any further development with Designer.

Designer should support built in types and new data types like Intervals, etc.

It doesn’t.

As we move on to 11g and onward it will become less and less feasible to build systems using it.

]]>
By: Alex Nuijten https://technology.amis.nl/2006/12/19/disappearing-columns/#comment-4169 Wed, 20 Dec 2006 09:41:26 +0000 http://technology.amis.nl/blog/?p=1444#comment-4169 @Nigel:
Unfortunately it is not possible in Designer to set a flag to prevent generation of Types, you can for packages, procedures and the like but not for Types.
I am having trouble to see your workaround though, how is it possible to define a column in a table which has the XMLType as it’s datatype?
Good point on revoking the CREATE TYPE privilege, too bad we need it for other Types.

@Marco
Do you ever sleep? 😉
The XMLType that was created erroneously by the Designer Generator was the one I wanted to get rid of. Not the “real” XMLType which would destroy your XML DB…
Talking about reserved words, consider this:

SQL> declare
2 xmltype varchar2(10);
3 begin
4 xmltype := ‘Hello';
5 dbms_output.put_line (xmltype);
6 end;
7 /
Hello

PL/SQL procedure successfully completed.

SQL> ed
Wrote file afiedt.buf

1 declare
2 date varchar2(10);
3 begin
4 date := ‘Hello';
5 dbms_output.put_line (date);
6* end;
SQL> /
Hello

PL/SQL procedure successfully completed.

SQL>

]]>
By: Marco Gralike https://technology.amis.nl/2006/12/19/disappearing-columns/#comment-4168 Wed, 20 Dec 2006 02:10:48 +0000 http://technology.amis.nl/blog/?p=1444#comment-4168 …and found a great post from Dizwell here: http://www.dizwell.com/prod/node/61?option=com_content&task=view&id=63&Itemid=86

]]>
By: Marco Gralike https://technology.amis.nl/2006/12/19/disappearing-columns/#comment-4167 Wed, 20 Dec 2006 01:52:47 +0000 http://technology.amis.nl/blog/?p=1444#comment-4167 One can drop the unused column via:

ALTER TABLE table_name DROP UNUSED COLUMNS;

]]>
By: Marco Gralike https://technology.amis.nl/2006/12/19/disappearing-columns/#comment-4166 Wed, 20 Dec 2006 00:42:55 +0000 http://technology.amis.nl/blog/?p=1444#comment-4166 Extra info can be found here: http://forums.oracle.com/forums/thread.jspa?threadID=456013

]]>
By: Marco Gralike https://technology.amis.nl/2006/12/19/disappearing-columns/#comment-4165 Wed, 20 Dec 2006 00:21:52 +0000 http://technology.amis.nl/blog/?p=1444#comment-4165 Hell of a way to destroy your XML DB environment in ONE statement. Tested it on 10.2.0.3.0 EE and will log a SR for this.

]]>
By: Nigel Thomas https://technology.amis.nl/2006/12/19/disappearing-columns/#comment-4164 Tue, 19 Dec 2006 22:30:50 +0000 http://technology.amis.nl/blog/?p=1444#comment-4164 Alex,

Can’t you mark the user type definition in Designer to prevent DDL generation? or does that stop you generating the columns themselves?

If not, you could try fooling Designer; make a variant of USER_TYPES that includes XMLTYPES – something like:

create view USER_TYPES as
select * from sys.user_types
UNION
select ‘XMLTYPE’, …
from DUAL where not exists (
select 1 from sys.user_types
where type_name=’XMLTYPE’
);

Of course it’s horrible – but it might be worth it if you think this mistake might happen again…

Finally, if you don’t normally use user-defined types, try revoking CREATE TYPE privilege.

Regards Nigel

]]>