Rename column in Oracle 9i
Can we rename column in Oracle 9i?
Thanks,
Alex
I don't think it should be that complicated unless you have any contraints to it. Do you have any foreign keys that are referencing to this particular table ? Also let me know what syntax are you using for dropping the column ?
Also look at the following example, try these things on some test/dummt table first.
Dropping a Column: Example
===========================
This statement illustrates the drop_column_clause with CASCADE CONSTRAINTS. Assume table t1 is created as follows:
CREATE TABLE t1 (
pk NUMBER PRIMARY KEY,
fk NUMBER,
c1 NUMBER,
c2 NUMBER,
CONSTRAINT ri FOREIGN KEY (fk) REFERENCES t1,
CONSTRAINT ck1 CHECK (pk > 0 and c1 > 0),
CONSTRAINT ck2 CHECK (c2 > 0)
An error will be returned for the following statements:
/* The next two statements return errors:
ALTER TABLE t1 DROP (pk); -- pk is a parent key
ALTER TABLE t1 DROP (c1); -- c1 is referenced by multicolumn
-- constraint ck1
Submitting the following statement drops column pk, the primary key constraint, the foreign key constraint, ri, and the check constraint, ck1:
ALTER TABLE t1 DROP (pk) CASCADE CONSTRAINTS;
If all columns referenced by the constraints defined on the dropped columns are also dropped, then CASCADE CONSTRAINTS is not required. For example, assuming that no other referential constraints from other tables refer to column pk, then it is valid to submit the following statement without the CASCADE CONSTRAINTS clause:
ALTER TABLE t1 DROP (pk, fk, c1);
Shalu
Similar Messages
-
Error while renaming column in Apex 3.2.1
Hi,
I am getting the following error while renaming column in Oracle Apex 3.2.1 through SQL workshop:
"ORA-24344: success with compilation error"
Interestingly, it only gives an error when I rename the column again to its original name. For example, if I renaming the column X to X1 (no problem) but renaming back to X, I get this error. Same is true for X to X1 to X2 without any issues but renaming back from X2 to either X1 or X, I get the same error.
Any insight into this issue would be very helpful and greatly appreciated.
Thanks,
MilaanI've moved a step ahead, getting the new apex screen at http://127.0.0.1:8080/apex/ and can also login to my application. However there is no image for Application Express on http://127.0.0.1:8080/apex/ and I cannot click on the Login button. Hitting http://127.0.0.1:8080/i/ does list down the images. Any clue on what could be the problem?
For others reference: I'm not sure what was wrong, but I tried the entire steps again, with the 2 changes: shutdown the listener and job process ( in step 3.1) before running 'apexins' and second that I installed on SYSAUX and not USERS (in step 4)
1. Downloaded apex_3.2.1.zip to C:\Software
2. unzip apex_3.2.1.zip to C:\Software\apex
3. started command prompt and set these variables
set ORACLE_HOME=C:\oraclexe\app\oracle\product\10.2.0\server
set ORACLE_SID=xe
set ORACLE_PATH=C:\oraclexe\app\oracle\product\10.2.0\server\bin
set LD_LIBRARY_PATH=C:\oraclexe\app\oracle\product\10.2.0\server\lib
3.1 Shutdown the listener and job services
4.
sqlplus /nolog
CONNECT SYS as SYSDBA
@apexins SYSAUX SYSAUX TEMP /i/
5.
sqlplus /nolog
CONNECT SYS as SYSDBA
@apxchpwd
6.
Stopped and Started the Database, also the listener and job processes
7.
sqlplus /nolog
connect sys as sysdba
@apxldimg.sql c:\software
8.
sqlplus /nolog
connect sys as sysdba
exec dbms_xdb.setListenerLocalAccess (l_access => FALSE); -
Can we rename a column in Oracle 8.1.7.4 version?
Can we rename a column in Oracle 8.1.7.4 version?
Hi,
There is no direct way of doing it but if you have DBA access then try this: (these 2 tables are in SYS user)
SELECT obj#
FROM obj$
WHERE name = 'your table name';
SELECT col#
FROM col$
WHERE obj# = obj# from above query
AND name = 'your column name';
UPDATE col$
SET name = 'new column name'
WHERE obj# = obj# from first query
AND col# = col# from above query;
And this change might not be immediately visible.
So once you are done with above, run the following:
ALTER SYSTEM FLUSH SHARED_POOL;
Then go to the respective user and describe the table and you will see new name. There might be some mistake in the above queries as I could not test it because I don't have ORACLE on my current system.
Hope this helps.
Regards
-Rajeev -
How to rename column name of table?
Hello...
How to rename column name of table?
The column have data.
Thanks.
Martonio.The following should work in 9i release 2 and above.
SQL> create table mytable(col1 varchar2(2),
2 col2 date);
Table created.
SQL> insert into mytable values('t1',sysdate);
1 row created.
SQL> select * from mytable;
CO COL2
t1 30-NOV-04
1 row selected.
SQL> desc mytable
Name Null? Type
COL1 VARCHAR2(2)
COL2 DATE
SQL> alter table mytable rename column col2 to mydate;
Table altered.
SQL> desc mytable
Name Null? Type
COL1 VARCHAR2(2)
MYDATE DATE
SQL> select * from mytable;
CO MYDATE
t1 30-NOV-04
1 row selected.
SQL> disconnect
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.3.0 - Productionhttp://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/wnsql.htm#972698 -
Can oracle 8i gives a facility to rename column ? How ?
Thanks in Adv.Its a bit longer process but u can do it:
SELECT obj#
FROM sys.obj#
WHERE name = '<your_table_name>';
SELECT col#
FROM sys.col$
WHERE obj# = <obj# from the above query>
AND name = '<column_name>';
UPDATE sys.col$
SET name = '<new_column_name>'
WHERE obj# = <obj# used in the above query>
AND col# = <col# from the above query>;
It won't show the effect immediately. So use this:
ALTER SYSTEM FLUSH SHARED_POOL;
Now describe the table and find the new column name :)
Hope this helps.
-Rajeev -
Hi
It's anyway to rename a column name in the Table name?
For info I using Oracle DB 9.2
regards
wismanUnder no circumstances should you change the data dictionary unless:[list=1]
[*]Oracle support tells you to;
[*]you really want to re-build your database.
[list]
Point 2 is not likely but it is a real possibility so take a full backup.
If you are on 8i the proper way to do it is this:[list=1]
[*]ALTER TABLE my_table ADD (new_name varchar2(10));
[*]UPDATE my_table SET new_name = old_name;
[*]ALTER TABLE my_table DROP COLUMN (old_name);
[list]
Obviously you'll need to handle integrity constraints, etc.
If you are on 9i you can do this:
ALTER TABLE my_table RENAME COLUMN old_name TO new_name;Cash back! APC -
alter table tablename change oldcolumnnname to newcolumnname;
but it has given partition or subpartition keyword is missing
please suggest ..
db: oracle 11g
regards
rajraj_fresher wrote:
alter table mytabl rename column old_col to new_col
this gives me the errorIt shouldn't, 11g too:
SQL> alter table test_tab rename column x to y;
Table altered. -
How to make column range based on a column in Oracle BI 11g
Hello everyone!
I want to know, how to make column range from a column in oracle bi 11g.
for example!
I have a column amounts and I want to build on this with other values of quantity, other column range 1-9,10-49,50-99,100-249, 249 o more.
regards!
when I try to make the range I have error.
Syntax error [nQSError: 26012] . (HY000)
SQL Issued: SELECT CASE WHEN "CUBO_DEEE_TAB"."CANTIDAD" BETWEEN 1 AND 9 THEN 1 a 9 ELSE "CUBO_DEEE_TAB"."CANTIDAD" END FROM "DM_DEEE"
Edited by: 964157 on 09-oct-2012 11:50You cannot add columns dynamically. But you can define a maximum number of numbers and then hide unused columns in your form useing SET_ITEM_PROPERTY(..,VISIBLE, PROPERTY_FALSE);
-
Deleting duplicate rows based on three columns in Oracle 8i
Hi all,
The database we use is Oracle 8i.
The query below raises the too_many_rows exception when I launch an application. So I want to delete the duplicated rows :
select polarisation_1, polarisation_2
into v_pol1_tech, v_pol2_tech
from v_cfh_lien_element
where nom_lien = p_nom_lien
AND num_canal_1 = p_num_canal_1
AND freq_emise_1 = p_freq_emise_1;
Notice that with many possible values of the parameters p_nom_lien, p_num_canal_1 and p_freq_emise_1 then the exception is raised.
So how to delete generally the duplicated rows based on the three columns "nom_lien" , "num_canal_1" and "freq_emise_1" ?
Thank you very much indeed.Check the other thread with same question deleting duplicate rows based on three columns in Oracle 8i
-
How to update html file in clob column in oracle
hi,
please help me how to update html file in clob column in oracle
ThanksThis is your main query as i am able to understand and you want to update your html file into terms columns based on conditions :
SELECT b.terms As terms
FROM chklst_item_x_enrlmnt_type a, prvdr_enrlmnt_agreement b
WHERE a.enrlmnt_type_cid = 1
AND a.chklst_item_cid = b.chklst_item_cid
AND a.chklst_item_cid = 79
AND a.oprtnl_flag = 'A'
AND b.oprtnl_flag = 'A'
AND TRUNC (SYSDATE) BETWEEN b.from_date AND b.TO_DATE;So i suggest below one but you need to create a directory where you can store your html file and then you can update .. And remaining consult Experts suggestions too as your
question is improperly posted . . .
DECLARE
vclob CLOB;
v_bfile BFILE := BFILENAME ('YOUR_DIR', 'filename.html');
BEGIN
SELECT b.terms
INTO vclob
FROM chklst_item_x_enrlmnt_type a, prvdr_enrlmnt_agreement b
WHERE a.enrlmnt_type_cid = 1
AND a.chklst_item_cid = b.chklst_item_cid
AND a.chklst_item_cid = 79
AND a.oprtnl_flag = 'A'
AND b.oprtnl_flag = 'A'
AND TRUNC (SYSDATE) BETWEEN b.from_date AND b.TO_DATE
FOR UPDATE;
DBMS_LOB.fileopen (v_bfile);
DBMS_LOB.loadfromfile (vclob, v_bfile, DBMS_LOB.getlength (v_bfile));
DBMS_LOB.fileclose (v_bfile);
END;
/ Regards.. -
Case INSENSITIVE Columns on Oracle
Hello Friends,
Good Monday for everyone....
I would like to ask you guys if there is a way to create a case INSENSITIVE Columns on Oracle. I used on Sqlserver before the COLLATE sintax, and I was able to make a columns (just that one) INSENSITIVE.
I'm using oracle 10gr2 on Windows plataform and herte is my nls_parameters. My ideia is to search on this column without the need of performing a function UPPER and LOWER and etc...
NLS_LANGUAGE BRAZILIAN PORTUGUESE
NLS_TERRITORY BRAZIL
NLS_CURRENCY Cr$
NLS_ISO_CURRENCY BRAZIL
NLS_NUMERIC_CHARACTERS ,.
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD/MM/RR
NLS_DATE_LANGUAGE BRAZILIAN PORTUGUESE
NLS_CHARACTERSET WE8MSWIN1252
NLS_SORT WEST_EUROPEAN
NLS_TIME_FORMAT HH24:MI:SSXFF
NLS_TIMESTAMP_FORMAT DD/MM/RR HH24:MI:SSXFF
NLS_TIME_TZ_FORMAT HH24:MI:SSXFF TZR
NLS_TIMESTAMP_TZ_FORMAT DD/MM/RR HH24:MI:SSXFF TZR
NLS_DUAL_CURRENCY Cr$
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
tks a lot
KeenAPC wrote:
No, they mean a setting which makes "APC" or "apc" match "Apc".
There is nothing to be done on 10g, other than building a function based index on the column in question, so that any UPPER() searches are optimized.
Well, as Kamran Agayev already noted CI is available in 10g too. It also worth mentioning FBI creates a hidden column. Also, your statement
In 11g we have the option to set the NLS_SORT parameter so that any searches are case-insensitive (or indeed accent insensitive). Find out more.
is incomplete. NLS_SORT affects nothing but sort:
SQL> connect scott
Enter password: *****
Connected.
SQL> select * from v$version
2 /
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
SQL> with t as (
2 select 'Max' name from dual union all
3 select 'sam' name from dual union all
4 select 'Joe' name from dual union all
5 select 'max' name from dual union all
6 select 'joe' name from dual union all
7 select 'Sam' name from dual
8 )
9 select name
10 from t
11 order by name
12 /
NAM
Joe
Max
Sam
joe
max
sam
6 rows selected.
SQL> with t as (
2 select 'Max' name from dual union all
3 select 'sam' name from dual union all
4 select 'Joe' name from dual union all
5 select 'max' name from dual union all
6 select 'joe' name from dual union all
7 select 'Sam' name from dual
8 )
9 select name
10 from t
11 where name = 'max'
12 /
NAM
max
SQL> alter session set nls_sort = binary_ci
2 /
Session altered.
SQL> with t as (
2 select 'Max' name from dual union all
3 select 'sam' name from dual union all
4 select 'Joe' name from dual union all
5 select 'max' name from dual union all
6 select 'joe' name from dual union all
7 select 'Sam' name from dual
8 )
9 select name
10 from t
11 order by name
12 /
NAM
Joe
joe
max
Max
Sam
sam
6 rows selected.
SQL> with t as (
2 select 'Max' name from dual union all
3 select 'sam' name from dual union all
4 select 'Joe' name from dual union all
5 select 'max' name from dual union all
6 select 'joe' name from dual union all
7 select 'Sam' name from dual
8 )
9 select name
10 from t
11 where name = 'max'
12 /
NAM
max
SQL> with t as (
2 select 'Max' name from dual union all
3 select 'sam' name from dual union all
4 select 'Joe' name from dual union all
5 select 'max' name from dual union all
6 select 'joe' name from dual union all
7 select 'Sam' name from dual
8 )
9 select name
10 from t
11 where name like 'm%'
12 /
NAM
max
SQL> select 'Max' name from dual union
2 select 'max' name from dual
3 /
NAM
Max
max
SQL> with t as (
2 select 'Max' name from dual union all
3 select 'sam' name from dual union all
4 select 'Joe' name from dual union all
5 select 'max' name from dual union all
6 select 'joe' name from dual union all
7 select 'Sam' name from dual
8 )
9 select distinct name
10 from t
11 /
NAM
sam
Joe
joe
max
Sam
Max
6 rows selected.
SQL> As you can see, NLS_SORT alone works on sort but not on "searches". We also need to set NLS_COMP, which by default is BINARY. Prior to 10g R2 (I am not 100% sure, it could be prior 10g), the only NLS_COMP choice, besides BINARY, was ANSI. However, ANSI does not work with all comparison operators (e.g. does not work for LIKE, UNION, DISTINCT):
SQL> alter session set nls_sort = binary_ci
2 /
Session altered.
SQL> alter session set nls_comp=ansi
2 /
Session altered.
SQL> with t as (
2 select 'Max' name from dual union all
3 select 'sam' name from dual union all
4 select 'Joe' name from dual union all
5 select 'max' name from dual union all
6 select 'joe' name from dual union all
7 select 'Sam' name from dual
8 )
9 select name
10 from t
11 order by name
12 /
NAM
Joe
joe
max
Max
Sam
sam
6 rows selected.
SQL> with t as (
2 select 'Max' name from dual union all
3 select 'sam' name from dual union all
4 select 'Joe' name from dual union all
5 select 'max' name from dual union all
6 select 'joe' name from dual union all
7 select 'Sam' name from dual
8 )
9 select name
10 from t
11 where name = 'max'
12 /
NAM
Max
max
SQL> with t as (
2 select 'Max' name from dual union all
3 select 'sam' name from dual union all
4 select 'Joe' name from dual union all
5 select 'max' name from dual union all
6 select 'joe' name from dual union all
7 select 'Sam' name from dual
8 )
9 select name
10 from t
11 where name like 'm%'
12 /
NAM
max
SQL> select 'Max' name from dual union
2 select 'max' name from dual
3 /
NAM
Max
max
SQL> with t as (
2 select 'Max' name from dual union all
3 select 'sam' name from dual union all
4 select 'Joe' name from dual union all
5 select 'max' name from dual union all
6 select 'joe' name from dual union all
7 select 'Sam' name from dual
8 )
9 select distinct name
10 from t
11 /
NAM
sam
Joe
joe
max
Sam
Max
6 rows selected.
SQL> Starting 10g R2 NLS_COMP can be set to LINGUISTIC, which will also work for LIKE and UNION but not for DISTINCT:
SQL> alter session set nls_sort = binary_ci
2 /
Session altered.
SQL> alter session set nls_comp=linguistic
2 /
Session altered.
SQL> with t as (
2 select 'Max' name from dual union all
3 select 'sam' name from dual union all
4 select 'Joe' name from dual union all
5 select 'max' name from dual union all
6 select 'joe' name from dual union all
7 select 'Sam' name from dual
8 )
9 select name
10 from t
11 order by name
12 /
NAM
Joe
joe
max
Max
Sam
sam
6 rows selected.
SQL> with t as (
2 select 'Max' name from dual union all
3 select 'sam' name from dual union all
4 select 'Joe' name from dual union all
5 select 'max' name from dual union all
6 select 'joe' name from dual union all
7 select 'Sam' name from dual
8 )
9 select name
10 from t
11 where name = 'max'
12 /
NAM
Max
max
SQL> with t as (
2 select 'Max' name from dual union all
3 select 'sam' name from dual union all
4 select 'Joe' name from dual union all
5 select 'max' name from dual union all
6 select 'joe' name from dual union all
7 select 'Sam' name from dual
8 )
9 select name
10 from t
11 where name like 'm%'
12 /
NAM
Max
max
SQL> select 'Max' name from dual union
2 select 'max' name from dual
3 /
NAM
Max
SQL> with t as (
2 select 'Max' name from dual union all
3 select 'sam' name from dual union all
4 select 'Joe' name from dual union all
5 select 'max' name from dual union all
6 select 'joe' name from dual union all
7 select 'Sam' name from dual
8 )
9 select distinct name
10 from t
11 /
NAM
sam
Joe
joe
max
Sam
Max
6 rows selected.
SQL> However even LINGUISTIC does not work with:
• CLOB or NCLOB data types
• Object data types
• Table partitions
• Index-organized tables
SY. -
Hi Guys,
I want to rename the column name of a table. Lets say I have table employee:
SQL> desc emp;
Name Null? Type
EMPNO NOT NULL NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
STARS VARCHAR2(8)
I want to change the name of the cloumn name of ENAME to EMPNAME so that structure looks like this:
SQL> desc emp;
Name Null? Type
EMPNO NOT NULL NUMBER(4)
EMPNAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
STARS VARCHAR2(8)
Can anyone tell me any statement or way to solve this problem. Please keep in mind that I will not delete the table or create another column name of EMPNAME and copy the data from ENAME to EMPNAME.
Regds,
DebabrataALTER TABLE DEPT2 RENAME COLUMN ENAME TO EMPNAME
Regards,
Raj -
Streaming data to LONG columns in Oracle 7.3.2.3.0
I am trying to stream data to a LONG column. I'm using Oracle
Server 7.3.2.3.0 on AIX and JDBC driver 8.0.4 on Windows NT 4
SP5.
I include sample tables/programs at the end, but here's the
summary of what's happening:
I'm creating a byte array of length 2500. If I use
setAsciiStream I get the following exception when I execute the
prepared statement:
java.sql.SQLException: Data size bigger than max size for this
type
at oracle.jdbc.dbaccess.DBError.check_error(DBError.java)
at oracle.jdbc.ttc7.TTCItem.setArrayData(TTCItem.java)
at oracle.jdbc.driver.OraclePreparedStatement.setItem
(OraclePreparedStat
ement.java)
at
oracle.jdbc.driver.OraclePreparedStatement.setAsciiStream
(OraclePrepa
redStatement.java)
at TestOracle.main(TestOracle.java:26)
If I use setBinaryStream I get this exception:
java.sql.SQLException: ORA-01461: can bind a LONG value only for
insert into a LONG column
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7
(TTC7Protocol.java)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch
(TTC7Protocol.java)
at oracle.jdbc.driver.OracleStatement.doExecuteOther
(OracleStatement.jav
a)
at oracle.jdbc.driver.OracleStatement.doExecuteWithBatch
(OracleStatement
.java)
at oracle.jdbc.driver.OracleStatement.doExecute
(OracleStatement.java)
at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout
(OracleStateme
nt.java)
at
oracle.jdbc.driver.OraclePreparedStatement.executeUpdate
(OraclePrepar
edStatement.java)
at oracle.jdbc.driver.OraclePreparedStatement.execute
(OraclePreparedStat
ement.java)
at TestOracle.main(TestOracle.java:27)
My Oracle7 manual states that LONG columns can store 2GB of text.
I tried the above with LONG RAW columns and it worked fine.
Can anyone explain why I get this error? I've tried it with
different sizes and when the data is <2000 bytes it works fine
for LONG columns.
My table is simple:
create table TestLongs (key INTEGER PRIMARY KEY, data LONG);
My Java code is also very simple:
public class TestOracle
public static void main(String[] args)
Connection con = null;
PreparedStatement pstmt = null;
try
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection(
"jdbc:oracle:thin:@itchy:1526:test",
"System", "<OMITTED>");
byte[] data = new byte[2500];
for (int i=0; i< 2500; i++)
data[i] = 53;
String sql = "INSERT INTO TestLongs (key, data)
VALUES(1, ?)";
pstmt = con.prepareStatement(sql);
ByteArrayInputStream bis = new ByteArrayInputStream
(data);
pstmt.setAsciiStream(1, bis, data.length);
pstmt.execute();
catch (SQLException e)
System.err.println("An error occurred with the
database: " + e);
e.printStackTrace();
catch (Exception e)
System.err.println("Oracle JDBC driver not found." +
e);
e.printStackTrace();
finally
try
if (pstmt != null)
pstmt.close();
if (con != null)
con.close();
catch (SQLException e)
System.err.println("Unable to close
statement/connection.");
nullRobert Greig (guest) wrote:
: I am trying to stream data to a LONG column. I'm using Oracle
: Server 7.3.2.3.0 on AIX and JDBC driver 8.0.4 on Windows NT 4
: SP5.
I tried it with the old 7.3.x JDBC driver and it works fine. I
also noticed after further testing that it sometimes worked
with the 8.0.4 driver. Looks like a bug in the 8.0.4 driver or
some wacky incompatibility.
null -
How to find encrypted columns in oracle 10g database
Hi,
How to find encrypted columns in oracle 10g database? We can see using view dba_encrypted_columns or all_encrypted_columns .
my question is apart from this is there anyother views or tables?
Thanks..user602872 wrote:
Hi,
How to find encrypted columns in oracle 10g database? We can see using view dba_encrypted_columns or all_encrypted_columns .
my question is apart from this is there anyother views or tables?Hmm not which I could find,
SQL> select * from dict where lower(table_name) like '%encrypted%';
TABLE_NAME
COMMENTS
DBA_ENCRYPTED_COLUMNS
Encryption information on columns in the database
ALL_ENCRYPTED_COLUMNS
Encryption information on all accessible columns
USER_ENCRYPTED_COLUMNS
Encryption information on columns of tables owned by the user
SQL>HTH
Aman.... -
How to create an automatically increment column in Oracle DB Table?
Hi To All
Here I am trying to create a table in Oracle that creates an automatically increment column in Oracle DB Table. i searched almost all Forums.(Even in Oracle). They are saying that, that logic u must implement in Java Code.(*Takes Maximum no from table, add +1 to it, and store it back again)*. apart from this, while creating an table in Oracle, is there any facility like MySQL Database? please help me. Thanks in advance.Hi BalusC
Thanks for Your Response and clue. with that, i succeeded in my application. Thank you very much. here i am giving you the details which i did.
1. I Created a table named orders in Oracle like this.
CREATE TABLE ORDERS (ORDER_ID NUMBER, CUSTOMER_ID NUMBER, ISBN NUMBER,
DESCRIPTION NCHAR(5));
2. I created one sequence in Oracle like CREATE SEQUENCE SEQ01 INCREMENT BY 1 START WITH 1000 3. Then i have written jdbc program like this
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class SequenceTest {
public static void main(String[] args)throws Exception{
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
String cols[] = {"ORDER_ID", "DESCRIPTION"};
PreparedStatement pstmt = con.prepareStatement("INSERT INTO ORDERS (ORDER_ID, CUSTOMER_ID, ISBN,DESCRIPTION) VALUES (SEQ01.NEXTVAL, 104, 966431505,?)", cols);
pstmt.setString(1,"Desc3");
pstmt.executeUpdate();
ResultSet rs=pstmt.getGeneratedKeys();
System.out.println("---- One Row Inserted ----");
} catch (Exception e) {
System.out.println("---- Failed Due To "+e);
4. When i ran above program 5 times, i got the following Data into my Oracle Table (select * from orders)
ORDER_ID CUSTOMER_ID ISBN DESCR
1000 101 966431502 Desc0
1001 102 966431503 Desc1
1002 103 966431504 Desc2
1003 104 966431505 Desc3
1004 104 966431505 Desc3
1005 105 966431506 Desc4
6 rows selected.
But i dont know how to do this type of program with out using prepared statements. i tried, and i got exception *"Missing Expression"* .
Once again Thank You very much for your clue.
Maybe you are looking for
-
Can I use one apple id to manage two seperate itunes libraries on two seperate pc's?
First time forum user, bear with me. I have two seperate PCs with two seperate ITunes loaded (both completely dependant of each other). On itunes and one pc manages my ipod, i now wnat a seperate pc and itunes to manage my iphone. Can I use the same
-
How to use Java code signing certificate in oracle 11i
Hello, I am try to configure java code signing certificate in 11.5.10.2 application. we got java sign certificate from verisgin. SA's imported the certificate and created alias XXX_XXX with password and passphrase. I am able to see the my certificate
-
Hi, Everything is in the title... I just "successfully" added my old PC to itunes match in order to listen to my old library on my mac, but itunes won't associate my music to anything : when I go to itunes match in itunes, all I can do is pay... And
-
I created package using AAMEE 3.1, using source of Adobe E-learning Suite 6.1 . During Package creation i selcted only Adobe Presenter 8. Package is serialized and also Adobe ID is there to login. Package created sucessfully. But when i run MSI it ro
-
Function module to subtract a number of months from a date
I have a field, FISCPER, in the format YYYY/MMM(2007004) and I need to subtract 12 months off of it to get 2006004. I tried to just subtreact 12 but it gave me the actual value when you subtract the 2.