Insert into table returning primary key (auto number) in resultset
Hi,
I'm connecting to Oracle 10g via JDBC (ojdbc14.jar).
My SQL statement is as follows:
INSERT into Student (studentName, phone, email, address) values ('Jason', '12345678', 'test', 'test');
SELECT Student_studentId_SEQ.NEXTVAL FROM DUAL;
Fyi -The Student table has a trigger to support the generation of a primary key (integer) based on a sequence when a new record is inserted.
What the above will do (from the Java app point of view) is to create a Student record and automatically select the student ID so that the student ID can be accessed via the resultset in Java.
I'm getting error "ORA-00911: invalid character". Can you please help?
Regards,
Jason
Edited by: user10394130 on Oct 13, 2008 2:40 AM
Yes, I'm referring to the studentId, which is generated via the Student table trigger on insert of a new record.
I've now verified that the following SQL works and it is "printing" the correct studentId.
DECLARE seqNbr_studentId NUMBER(12) := 0;
BEGIN
INSERT into Student (studentName, phone, email, address) values ('Jason', '12345678', 'test', 'test')
RETURNING studentId INTO seqNbr_studentId;
dbms_output.put_line(seqNbr_studentId);
END;
--> This prints the correct value of seqNbr_studentId that has been generated by the trigger. This is good.
However, I would like the studentId to be in a resultset (so that I can access this via Java Resultset.getInt(1) ), for example:
DECLARE seqNbr_studentId NUMBER(12) := 0;
BEGIN
INSERT into Student (studentName, phone, email, address) values ('Jason', '12345678', 'test', 'test')
RETURNING studentId INTO seqNbr_studentId;
SELECT seqNbr_studentId FROM DUMMYTABLE;
END;
Is this possible?
What I'm trying to do is to achieve the effect in SQL Server where I can simply do an SQL command "SELECT @@IDENTITY" where it returns the auto number from the newly inserted record.
Regards,
Jason
Edited by: user10394130 on Oct 13, 2008 2:08 AM
Edited by: user10394130 on Oct 13, 2008 2:56 AM
Similar Messages
-
EjbCreate returns primary key - auto increment
ejbCreate of a BMP entity bean must return the primary key.
If i have an auto-incrementer (in MySQL) and i insert the new data in this method, how can i then find the primary key to return?
Surely i cannot just use a select statement in another method as the other data in the table may not be unique and may not return the correct primary key.
Help Please
Thanks
DaveHi,
PreparedStatement ps = con.prepareStatement("INSERT INTO food_data (description)" + " VALUES (?)");
//Get generated primary key
ResultSet res = ps.getGeneratedKeys();
while (res.next())
{ key = res.getInt(1);
This code requires JDK 1.4.2.
Any other soln for previous versions of JDK (1.4.1 or 1.3.1)
Seetesh -
Insert into table error - ora-01722 invalid number
Need some assistance with inserting data into a table. The date column keeps on failing to insert.
here is my insert statement
insert into tab_mod_history (TABLE_OWNER, TABLE_NAME, PARTITION_NAME, SUBPARTITION_NAME, INSERTS, UPDATES, DELETES, TIMESTAMP, TRUNCATED)
values ('$i_owner','$i_table','$i_part_name','$i_subpart_name','$i_ins','$i_upd','$i_del','$time','$trunc');Script loads data for partition tables, but not normal tables with the timestamp column
I select the data using this select statement:
select table_owner, table_name, partition_name, subpartition_name, inserts, updates, deletes, timestamp, truncated
from dba_tab_modifications
where table_owner in ('scott','MAC')
order by table_name;ok here are the errors:
values ('MAC','WC_MST','11','1','1','12/04/2011','NO','','')
ERROR at line 2:
ORA-01722: invalid number
Session altered.
values ('MAC','WF_05A','208','128','208','18/02/2011','NO','','')
ERROR at line 2:
ORA-01722: invalid numberHere is the table structure
SQL> desc tab_mod_history
Name Null? Type
TABLE_OWNER VARCHAR2(30)
TABLE_NAME VARCHAR2(30)
PARTITION_NAME VARCHAR2(30)
SUBPARTITION_NAME VARCHAR2(30)
INSERTS NUMBER
UPDATES NUMBER
DELETES NUMBER
TIMESTAMP DATE
TRUNCATED VARCHAR2(3)
DROP_SEGMENTS NUMBERI used the column names to create the variables..that is why $time was used.
How else could I have done it????
thought this was easy..but to my dismay... -
How to insert into table when ID auto increment?
I have a table Employee with EmloyeeID, EmployeeName, Email...
When i design table in database, i created a Sequence and then Trigger for EmployeeID to auto increment.
Now in ADF, actually in my web form: I don't want enter values for EmployeeID to insert into table,
but still error : required for EmployeeID...
how can i do it? ThanksUser,
Always mention your JDev version every time you start a new thread.
Check this out : Andrejus Baranovskis Blog: How To Implement Gapless Sequence in ADF BC
-Arun -
1 duplicate key error during insert into table
Dear Guru's
While upgrading the SAP_HR patch, I am facing this issue
Current level is SAPKE60455
Trying to apply patch - SAPKE60456
This is seen in the import log
Start import R3TRVDATV_512W_O ...
client 000: 1
client 001: 1
client 070: 1
client 080: 1
client 100: 1
client 320: 1
1 duplicate key error during insert into table T512T occured
End import R3TRVDATV_512W_O (with warnings)
Please help, thank in advance
R3trans is at version 6.19
Regards,
OmkarHello,
Issue was resolved after upgrading the R3trans
Regards,
Omkar -
How to insert into table through reports
hi,
i m working on oracle reports 10g,i made a report which fatching some data & contains some function , i want to insert values of that functions into a table & how to update it if user again run that report.
like
data1 data2 data3
function1 function2
the values of function 1 & 2 shouls be insert into a table. if that user exist in table then update it otherwise insert that values;
thxsU can use SRW.DO_SQL built-in procedure . Check the reports online help from the reports builder.
Rajesh
FUNCTION CREATETAB RETURN BOOLEAN IS
BEGIN
SRW.DO_SQL('CREATE TABLE CHECK (EMPNO NUMBER NOT NULL
PRIMARY KEY, SAL NUMBER (10,2)) PCTFREE 5 PCTUSED 75');
RETURN(TRUE);
EXCEPTION
WHEN SRW.DO_SQL_FAILURE THEN
SRW.MESSAGE(100, 'ERROR WHILE CREATING CHECK TABLE.');
SRW.MESSAGE(50, 'REPORT WAS STOPPED BEFORE THE RUNTIME
PARAMETER FORM.');
RAISE
SRW.PROGRAM_ABORT;
END;
Edited by: RajeshAlex on Sep 30, 2008 12:10 PM -
EjbCreate() method return primary key genereted by database
Hello Everyone,
I have entity CMP EJB that maps MySQL database table, which is set to asign Primary key (integer) to new entries automatically by using AUTO_INCREMENT. The problem is ejbCreate(..) method, which returns primary key. My question is: how to make it return primary key generated by database?
ThanksHi,
I'm also facing the same problem also. The problem is: how do I code the ejbCreate method?
If I don't initialize the primary key field, I get a complaint that the primary key field needs to be initialized in ejbCreate.
But if I try to initialize it to an arbitrary value, the database won't allow me to do the insert, because the primary key is auto-generated. -
Insert into table a (select * from table b) - need pk?
Hi there.
I'm going to insert into table FINAL (select * from table STAGING) - same structure but in STAGING the ID column has nulls.
Do I need to provide the ID (primary key) for table FINAL or will it get created based on sequence/trigger?
If I were doing this in a loop I'd get the next val from the sequence but on a simple insert, I'm curious.
thanks!hmm.. what is ?
it didn't like it.
Error(11,4): PLS-00103: Encountered the symbol "[" when expecting one of the following: begin case declare exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge <a single-quoted SQL string> pipe
9i, sqldeveloper -
Null value in detail table's primary key
I use Business Components Data Form to define a master-detail java panel.
I don't display the primary key column in the detail grid control.
Then I click on "+" to add a row, enter a value (the 2nd part of the detail table's primary key) and click commit.
I get an error saying that the primary key column that's not displayed is null and the row cann't be committed.
How do I fix this error?My fields are varchar2's.
-- simplified to protect the guilty:
-- (made up from memory, so sql keywords may --be misspelled, but you get the idea)
create table proj (
proj varchar2(10) not null,
constraint proj_pk
primary key(proj)
insert into proj values ('abc');
commit;
-- this table has legal values for -- the master.legal field.
-- in master, legal was changed to a -- ComboBoxControl control from -- TextFieldControl that the wizard -- generated.
create table legal_values (
proj varchar2(10) not null,
legal varchar2(10) not null,
display_order integer not null,
constraint legal_values_pk
primary key (proj, legal)
insert into legal_values
values ('abc', 'one', 1);
insert into legal_values
values ('abc', 'two', 2);
insert into legal_values
values ('abc', 'three', 3);
commit;
create table master (
proj varchar2(10) not null,
masterKey varchar2(15) not null,
legal varchar2(10) not null,
constraint master_pk
primary key (proj, masterKey)
create table detail (
proj varchar(10) not null,
masterKey varchar(15) not null,
detailkey varchar(10) not null,
display_order integer not null,
status varchar2(12) not null, -- user can only update this field
constraint detail_pk
primary key(proj, masterkey, detailkey)
-- legal rows for detail table
create table detail_values (
proj varchar2(10) not null,
detailkey varchar2(10) not null,
display_order integer not null,
constraint detail_values_pk
primary key(proj, detailkey)
insert into detail_values values
('abc', 'status a', 1);
insert into detail_values values
('abc', 'status b', 2);
commit;
-- if their is a foriegn key on details back
-- to master, then you get the
-- "mutating table" error when trigger
-- occurs.
create or replace trigger master_tr
after insert on master
for each row
begin
insert into detail
(masterKey, detailKey, status, display_order, status)
select :new.masterkey, detail_key, display_order, ' '
from detail_values;
end;
-- detail.status is a comboboxControl getting --its values of of another db table too.
-- there's also "after update" triggers on master and detail tables that copy the record to master_history and "detail_history" tables if the corresponding table is modified. Thus we have a history of the changes made to the records. The 2 history tables have 2 additional fields than their parents, "modified_date date default sysdate not null" and "modified_by varchar2(30) default user not null" that record when and who made the change. There's also a change type field that records where the change is an insert, delete or update (there 3 triggers per table , so we can correctly record change type as being insert, delete or update into the change_type field).
If you want to make it more real to life, the status value is initially blank, then can be changed to a legal status value (complete or not complete), but can not be changed back to blank.
***P.S. I have to have this ready for production by monday.****
P.P.S After you reply and change to ComboBoxControls in 2 places, try changing the table names and/or the column names (say to follow the DBA's naming convention) or add another field to the composite primary key (and unstated foriegn key) (using drop table/create table). Now try getting the existing code to run. No writing down the old/new table (or column) name pair names. Just run the code and try to fix the code based on the error messages. Are the error messages giving you adequate information to find the problem? -
Data is not inserting into table
Hi Team,
I am inserting data into a custom table.
but my records are not inserting into table
//CO File
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
OAApplicationModule am = pageContext.getApplicationModule(webBean);
am.invokeMethod("createEmployee");
// am.invokeMethod("init");
* Procedure to handle form submissions for form elements in
* a region.
* @param pageContext the current OA page context
* @param webBean the web bean corresponding to the region
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);
OAApplicationModule am = pageContext.getApplicationModule(webBean);
if (pageContext.getParameter("Apply") != null)
OAViewObject vo = (OAViewObject)am.findViewObject("TestEmpVO1");
String NAME = (String)vo.getCurrentRow().getAttribute("Name");
Number employeeNumber = (Number)vo.getCurrentRow().getAttribute("Num");
String NUM = String.valueOf(employeeNumber.intValue());
am.invokeMethod("apply");
MessageToken[] tokens = { new MessageToken("EMP_NAME", NAME),
new MessageToken("EMP_NUMBER", NUM) };
OAException confirmMessage = new OAException("AK", "FWK_TBX_T_EMP_CREATE_CONFIRM", tokens,
OAException.CONFIRMATION, null);
pageContext.putDialogMessage(confirmMessage);
else if (pageContext.getParameter("Cancel") != null)
am.invokeMethod("rollbackEmployee");
TransactionUnitHelper.endTransactionUnit(pageContext, "empCreateTxn");
// End CO
//AMImpl
package oracle.apps.fnd.framework.toolbox.labsolutions.server;
import oracle.jbo.Row;
import oracle.jbo.Transaction;
import oracle.jbo.RowSetIterator;
import oracle.jbo.domain.Number;
import oracle.apps.fnd.common.MessageToken;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.OARow;
import oracle.apps.fnd.framework.OAViewObject;
import oracle.apps.fnd.framework.server.OAViewObjectImpl;
// --- File generated by Oracle Business Components for Java.
public class TestEmpAMImpl extends EmployeeAMImpl
* This is the default constructor (do not remove)
public TestEmpAMImpl()
* Container's getter for TestEmpVO1
public TestEmpVOImpl getTestEmpVO1()
return (TestEmpVOImpl)findViewObject("TestEmpVO1");
* Creates a new employee.
public void createEmployee()
OAViewObject vo = (OAViewObject)getTestEmpVO1();
// Per the coding standards, this is the proper way to initialize a
// VO that is used for both inserts and queries. See View Objects
// in Detail in the Developer's Guide for additional information.
if (!vo.isPreparedForExecution())
vo.executeQuery();
Row row = vo.createRow();
vo.insertRow(row);
// Required per OA Framework Model Coding Standard M69
row.setNewRowState(Row.STATUS_INITIALIZED);
} // end createEmployee()
public void apply()
getDBTransaction().commit();
* Sample main for debugging Business Components code using the tester.
public static void main(String[] args)
launchTester("oracle.apps.fnd.framework.toolbox.labsolutions.server", "TestEmpAMLocal");
//End AmImpl
Please suggest.
Thanks,
AjitAjit,
Its always a good idea to close the thread with an explanation. It will help others whenever they are into similar situation.
--Shiv -
Reg: read excel column and insert into table.
hi Friends,
i wanted to read the data from Excel and insert into in my oracle tables.
can you provide the link or example script.
how to read the column value from excel and insert into table.
please help.< unnecessary reference to personal blog removed by moderator >
Here are the steps:
1) First create a directory and grant read , write , execute to the user from where you want to access the flat files and load it.
2) Write a generic function to load PIPE delimited flat files:
CREATE OR REPLACE FUNCTION TABLE_LOAD ( p_table in varchar2,
p_dir in varchar2 DEFAULT ‘YOUR_DIRECTORY_NAME’,
P_FILENAME in varchar2,
p_ignore_headerlines IN INTEGER DEFAULT 1,
p_delimiter in varchar2 default ‘|’,
p_optional_enclosed in varchar2 default ‘”‘ )
return number
is
– FUNCTION TABLE_LOAD
– PURPOSE: Load the flat files i.e. only text files to Oracle
– tables.
– This is a generic function which can be used for
– importing any text flat files to oracle database.
– PARAMETERS:
– P_TABLE
– Pass name of the table for which import has to be done.
– P_DIR
– Name of the directory where the file is been placed.
– Note: The grant has to be given for the user to the directory
– before executing the function
– P_FILENAME
– The name of the flat file(a text file)
– P_IGNORE_HEADERLINES
– By default we are passing 1 to skip the first line of the file
– which are headers on the Flat files.
– P_DELIMITER
– Dafault “|” pipe is been passed.
– P_OPTIONAL_ENCLOSED
– Optionally enclosed by ‘ ” ‘ are been ignored.
– AUTHOR:
– Slobaray
l_input utl_file.file_type;
l_theCursor integer default dbms_sql.open_cursor;
l_lastLine varchar2(4000);
l_cnames varchar2(4000);
l_bindvars varchar2(4000);
l_status integer;
l_cnt number default 0;
l_rowCount number default 0;
l_sep char(1) default NULL;
L_ERRMSG varchar2(4000);
V_EOF BOOLEAN := false;
begin
l_cnt := 1;
for TAB_COLUMNS in (
select column_name, data_type from user_tab_columns where table_name=p_table order by column_id
) loop
l_cnames := l_cnames || tab_columns.column_name || ‘,’;
l_bindvars := l_bindvars || case when tab_columns.data_type in (‘DATE’, ‘TIMESTAMP(6)’) then ‘to_date(:b’ || l_cnt || ‘,”YYYY-MM-DD HH24:MI:SS”),’ else ‘:b’|| l_cnt || ‘,’ end;
l_cnt := l_cnt + 1;
end loop;
l_cnames := rtrim(l_cnames,’,');
L_BINDVARS := RTRIM(L_BINDVARS,’,');
L_INPUT := UTL_FILE.FOPEN( P_DIR, P_FILENAME, ‘r’ );
IF p_ignore_headerlines > 0
THEN
BEGIN
FOR i IN 1 .. p_ignore_headerlines
LOOP
UTL_FILE.get_line(l_input, l_lastLine);
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
v_eof := TRUE;
end;
END IF;
if not v_eof then
dbms_sql.parse( l_theCursor, ‘insert into ‘ || p_table || ‘(‘ || l_cnames || ‘) values (‘ || l_bindvars || ‘)’, dbms_sql.native );
loop
begin
utl_file.get_line( l_input, l_lastLine );
exception
when NO_DATA_FOUND then
exit;
end;
if length(l_lastLine) > 0 then
for i in 1 .. l_cnt-1
LOOP
dbms_sql.bind_variable( l_theCursor, ‘:b’||i,
ltrim(rtrim(rtrim(
regexp_substr(l_lastLine,’([^|]*)(\||$)’,1,i),p_delimiter),p_optional_enclosed),p_optional_enclosed));
end loop;
begin
l_status := dbms_sql.execute(l_theCursor);
l_rowCount := l_rowCount + 1;
exception
when OTHERS then
L_ERRMSG := SQLERRM;
insert into BADLOG ( TABLE_NAME, ERRM, data, ERROR_DATE )
values ( P_TABLE,l_errmsg, l_lastLine ,systimestamp );
end;
end if;
end loop;
dbms_sql.close_cursor(l_theCursor);
utl_file.fclose( l_input );
commit;
end if;
insert into IMPORT_HIST (FILENAME,TABLE_NAME,NUM_OF_REC,IMPORT_DATE)
values ( P_FILENAME, P_TABLE,l_rowCount,sysdate );
UTL_FILE.FRENAME(
P_DIR,
P_FILENAME,
P_DIR,
REPLACE(P_FILENAME,
‘.txt’,
‘_’ || TO_CHAR(SYSDATE, ‘DD_MON_RRRR_HH24_MI_SS_AM’) || ‘.txt’
commit;
RETURN L_ROWCOUNT;
end TABLE_LOAD;
Note: when you run the function then it will also modify the source flat file with timestamp , so that we can have the track like which file was loaded .
3) Check if the user is having UTL_FILE privileges or not :
SQL> SELECT OWNER,
OBJECT_TYPE
FROM ALL_OBJECTS
WHERE OBJECT_NAME = ‘UTL_FILE’
AND OWNER =<>;
If the user is not having the privileges then grant “UTL_FILE” to user from SYS user:
SQL> GRANT EXECUTE ON UTL_FILE TO <>;
4) In the function I have used two tables like:
import_hist table and badlog table to track the history of the load and another to check the bad log if it occurs while doing the load .
Under the same user create an error log table to log the error out records while doing the import:
SQL> CREATE TABLE badlog
errm VARCHAR2(4000),
data VARCHAR2(4000) ,
error_date TIMESTAMP
Under the same user create Load history table to log the details of the file and tables that are imported with a track of records loaded:
SQL> create table IMPORT_HIST
FILENAME varchar2(200),
TABLE_NAME varchar2(200),
NUM_OF_REC number,
IMPORT_DATE DATE
5) Finally run the PLSQL block and check if it is loading properly or not if not then check the badlog:
Execute the PLSQL block to import the data from the USER:
SQL> declare
P_TABLE varchar2(200):=<>;
P_DIR varchar2(200):=<>;
P_FILENAME VARCHAR2(200):=<>;
v_Return NUMBER;
BEGIN
v_Return := TABLE_LOAD(
P_TABLE => P_TABLE,
P_DIR => P_DIR,
P_FILENAME => P_FILENAME,
P_IGNORE_HEADERLINES => P_IGNORE_HEADERLINES,
P_DELIMITER => P_DELIMITER,
P_OPTIONAL_ENCLOSED => P_OPTIONAL_ENCLOSED
DBMS_OUTPUT.PUT_LINE(‘v_Return = ‘ || v_Return);
end;
6) Once the PLSQL block is been executed then check for any error log table and also the target table if the records are been successfully imported or not. -
How to add a new data element for existing table filed(Primary key field)
Hi Experts,
How to add a new data element for existing table field(Primary key field)
For this filed ther is no foreign key relation ships and even check table.
while activating table it is giving message like below.
can you help any one to solve this and wil steps to add new dataelement for existing primary key filed of a table.
Check table (NAMING SPACE/TABLE NAME(EX:/TC/VENDOR)) (username/19.02.10/03:29)
Primary key change not permitted for value table /TC/VENDOR
Check on table /TC/VENDOR resulted in errors
Thanks
RaviHi,
Easiest way is to download the table eg into an Excel table (if possible) or text table. Drop the table from the database. Build your table with the new key field. Build the database table again and fill it.
You can do it also over the database into a new table. Drop the old one. Build the enhanced one and fill it. Afterwards drop your (temporary) table.
Maybe there are other ways, but this works.
Success,
Rob -
How do i insert into table through forms
Hi
I have developed a custom form based on custom table.
the only way to insert data into database table is through form.
there are two tables: one table is to store all contract details & second table is to maintain history forthis.
one condition(col1,col2,col3,col4) are unique combination,we are not creating any PK or FK at database level.evrythng is captured at form level.
if all 4 columns combination exist thn e should not insert that record.
if 4 columns combination doesnot exist then insert into table.
I have used just pre insert,pre update triggers.
I think its a basic form functionality ,by itself it inserts ,update record.now it is doing the same thng.
But I have to add the above condition ,how can i do that.
Pl provide me some ex code .
Thank you.
Hope any one can help meSQL> create table t
2 (object_id number
3 ,object_name varchar2(30));
Table created.
SQL>
SQL> create sequence t_seq;
Sequence created.
SQL>
SQL> insert into t (object_id, object_name)
2 select t_seq.nextval
3 ,object_name
4 from all_objects
5 ;
52637 rows created. -
below i post my code :
import java.util.*;
import java.sql.*;
import java.io.*;
import com.hxtt.sql.*;
public class backofficeDbfVerification {
public backofficeDbfVerification(String path) throws SQLException {
Properties prop = new Properties();
prop.setProperty("user", "");
prop.setProperty("OtherExtensions","true");
prop.setProperty("Version Number", "03");
try {
Class.forName("com.hxtt.sql.dbf.DBFDriver").newInstance();
connection = DriverManager.getConnection("jdbc:DBF:/"+path, prop);
catch (ClassNotFoundException classnotfoundexception) {
System.out.println("could ot find HXTT class, make sure the classpath have been defined in your system !");
catch(Exception e) {
System.out.println(e.getMessage());
public void createBadRecord(String table, String newtable, int blth) throws SQLException {
Statement stmt = connection.createStatement();
String insert = "insert into \""+newtable+"\" select * from \""+table+"\"";
boolean bInsert = stmt.execute(insert);
stmt.close();
public static void main (String args[]) {
String path = "C:\\MASTER\\SOURCEDATA\\AREA";
try {
backofficeDbfVerification test = new backofficeDbfVerification(path);
test.createBadRecord("source\\area\\123.AA2","source\\area\\others\\89964568.AA1");
catch(SQLException sqx) {
System.out.println("Error "+sqx.getMessage());
i try to perform simple query : insert into tablea select from tableb which has same structure. the source table has only 9 rows, but the process ran very long time, no error message raised,it just run and never end (which make me upset for the whole day).
i have tried another simple query : insert into table1 values (1,2) using the same driver and execute successfully.
is it becoz of function limitation since i used evaluation copy ?Copy the answer from HXTT's support forum:
No function limitation. I just tested:
create table testa1 select * from test;
insert into testa1 select * from test;
Passed.
I also run your backofficeDbfVerification.java sample. Passed too. I'm using the same code as you. The difference is only my 89964568.AA1 and 123.AA2 is simulative tables files. If possible, please zip your 89964568.AA1 and 123.AA2 and email to [email protected] Thanks.
BTW, I pasted the little modified backofficeDbfVerification.java below:
import java.sql.*;
import java.util.*;
public class backofficeDbfVerification {
Connection connection;
public backofficeDbfVerification(String path) throws SQLException {
Properties prop = new Properties();
prop.setProperty("user", "");
prop.setProperty("OtherExtensions", "true");
prop.setProperty("Version Number", "03");
try {
Class.forName("com.hxtt.sql.dbf.DBFDriver").newInstance();
connection = DriverManager.getConnection("jdbc:DBF:/" + path, prop);
catch (ClassNotFoundException classnotfoundexception) {
System.out.println("could ot find HXTT class, make sure the classpath have been defined in your system !");
catch (Exception e) {
System.out.println(e.getMessage());
public void createBadRecord(String table, String newtable) throws
SQLException {
Statement stmt = connection.createStatement();
String insert = "insert into \"" + newtable + "\" select * from \"" +
table + "\"";
boolean bInsert = stmt.execute(insert);
stmt.close();
public static void main(String args[]) {
String path = "f:\\dbffiles";
try {
backofficeDbfVerification test = new backofficeDbfVerification(path);
test.createBadRecord("source\\area\\123.AA2",
"source\\area\\others\\89964568.AA1");
catch (SQLException sqx) {
System.out.println("Error " + sqx.getMessage());
} -
Problem CREATE TABLE with PRIMARY KEY Still in Trouble ! Please Help!
Hi there !
I use the orcle 8i, and i don't know why i can't create table with any primary key EXample:
SQL> CREATE TABLE O_caisses
2 (No_caisse NUMBER(3) constraint caisses_pk PRIMARY KEY,
3 NB_BILLETS NUMBER(5)
4 )
5 /
CREATE TABLE O_caisses
ERROR at line 1:
ORA-18008: cannot find OUTLN schema
***********some Debuger show me this way: *********************
Well there r certain point u got to notice when creating a table with constraints.
1) U can create table with COLUMN level constraint.
2) U can create table with TABLE level constraint.
3) In COLUMN level constraint u can't give a constraint a name
but only mention the type of constraint.
4) In TABLE level constraint u can give a name to constraint.
Following are the examples of both
--COLUMN LEVEL
CREATE TABLE O_caisses
(No_caisse NUMBER(3) PRIMARY KEY,
NB_BILLETS NUMBER(5));
--TABLE LEVEL
CREATE TABLE O_caisses
(No_caisse NUMBER(3),
NB_BILLETS NUMBER(5),
constraint pk_caisse primary key (No_caisse));
********************And this is another one:*****************
SQL>grant create any outline to username;
BUT the problem is still present, i don't know what to do now !
Please could some body help me !
Thanks alot!
Luong.The clue is in the error message: the OUTLN schema is missing.
This is something Oracle 8i introduced to help manage the CBO (or soemthing equally geeky and internal). For some reason your database no longer has this user. It ought to be created automatically during installation (or upgrade) but catproct may not have completed probably or some over zealous admin type has dropped it.
Solution is to re-install (or re-upgrade) as you cannot create this user on their own. Alas.
HTH, APC
Maybe you are looking for
-
The Web Dynpro application XssMenuArea is expired
Some of our clients when click tab "Employee Self Service" the information menu wonu2019t be displayed and the screen has the following error message: the Web Dynpro application "XssMenuArea" is expired, please use the refresh button or restart the a
-
How do I change my apple id on my old macbook?
I long ago changed my apple i.d., but my old MacBook Pro is still requesting the password for the old one. The new one is integrated into everything else I use.
-
Reader Extension rights problem in Adobe Reader 9.x
Hi Experts, I was working on ADLC 8.2.3 version shipped by SAP. I am using reader 9.X My Development have one data source being used by 2 different dynamic forms where forms content enable and disable dynamically based on user inputs. Every time I sa
-
Workitem is not appearng in the user's inbox
Hi All, In my workflow the workitem is not appearing in the user's inbox. can anyone tell me how can i resolve this? thanks and regards, K.Perumalraj
-
SCOM warning about impersonation setting in sharepoint
SharePoint 2010 SP1 using Integrated authentication (AD) - we are getting a warning from SCOM saying that SharePoint web.config for "impersonation Mode" causes security hole. and referencing this kb article http://support.microsoft.com/kb/306158 - wh