DZone Forums
Go Back   DZone Forums > Community > Databases & SQL > Oracle
Reload this Page Very simple swing example from Oracle
Notices
Reply
 
LinkBack Thread Tools Display Modes
  (#1 (permalink)) Old
Member
 
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Oct 2008
Default Very simple swing example from Oracle - 10-03-2008, 10:34 AM

Could anyone provide the simplest of working examples of an update to an Oracle 9i table 'dual' with one collumn of type varchar2 via a Java Swing form?

I am struggling to penetrate thin client but failing with Oracle - and the documentation is not helping....



Thanks for any help...



R.
Reply With Quote
  (#2 (permalink)) Old
Moderator
 
jwenting's Avatar
 
Posts: 99
Thanks: 0
Thanked 8 Times in 8 Posts
Join Date: Feb 2008
Send a message via MSN to jwenting
Default 12-01-2008, 03:18 AM

"dual" is a kinda metatable, it doesn't exist. Updates to it have no effect (if they are possible at all).
It's mainly used where a select statement is required but no table is needed (like 'select sysdate into l_current_date from dual;').
Reply With Quote
  (#3 (permalink)) Old
Member
 
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Oct 2008
Default 12-01-2008, 04:08 AM

Hi,


update dual set dummy = 'p' - works quite nicely, actually - and the point of my request was I wanted the most extreme simple example of how to do an update against Oracle through a Swing form without getting hung up on the complexities that real world examples give - hence restricting my request to DUAL.


Quote:
Originally Posted by jwenting View Post
"dual" is a kinda metatable, it doesn't exist. Updates to it have no effect (if they are possible at all).
It's mainly used where a select statement is required but no table is needed (like 'select sysdate into l_current_date from dual;').
Reply With Quote
  (#4 (permalink)) Old
Moderator
 
jwenting's Avatar
 
Posts: 99
Thanks: 0
Thanked 8 Times in 8 Posts
Join Date: Feb 2008
Send a message via MSN to jwenting
Default 12-01-2008, 08:34 AM

maybe you can do it, but you won't get the result back again. DUAL is like /dev/null on Unix filesystems, it's a big black hole you can put things into that never come back.
You can however (unlike /dev/null) also pull anything out of it that never was put in.
Reply With Quote
  (#5 (permalink)) Old
Member
 
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Oct 2008
Default 12-01-2008, 09:35 AM

I beg to differ -


select *
from dual;

update dual set dummy = 'Y';

commit;

select *
from dual;

update dual set dummy = 'X';

commit;
select *
from dual;

update dual set dummy = 'Y';

commit;

select *
from dual;

update dual set dummy = 'X';

commit;



This yields -


D
-
X
1 row selected.
1 row updated.
Commit complete.

D
-
Y
1 row selected.
1 row updated.
Commit complete.


So sure - we treat dual like it is something different, but it is really just another table...

DROP TABLE SYS.DUAL CASCADE CONSTRAINTS;

CREATE TABLE SYS.DUAL
(
DUMMY VARCHAR2(1 BYTE)
)
TABLESPACE SYSTEM
PCTUSED 40
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 16K
NEXT 16K
MINEXTENTS 1
MAXEXTENTS 505
PCTINCREASE 50
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
NOMONITORING;


DROP PUBLIC SYNONYM DUAL;

CREATE PUBLIC SYNONYM DUAL FOR SYS.DUAL;


GRANT SELECT ON SYS.DUAL TO APPS;

GRANT ALTER, DELETE, INDEX, INSERT, REFERENCES, SELECT, UPDATE, ON COMMIT REFRESH, QUERY REWRITE, DEBUG, FLASHBACK ON SYS.DUAL TO PUBLIC WITH GRANT OPTION;

GRANT SELECT ON SYS.DUAL TO SYSTEM WITH GRANT OPTION;
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple Hit counter peter_rodrick PHP 2 03-27-2009 03:04 PM
Simple JMX monitoring tool vhrmo Java 2 02-16-2009 03:53 PM
One of the best Oracle forum llefevre Oracle 0 06-17-2008 08:25 AM
Oracle Driver Problem BarryC Java 1 05-19-2008 09:43 AM
Benchmarks MySQL vs. Oracle 10 bubujake MySQL 0 02-23-2008 10:17 PM


Copyright 1997-2009, DZone, Inc.
vBulletin Skin developed by: vBStyles.com