Oracle table creation/script help
Having a hard time running my script. Essentially I have to create a few table entries into the 3 tables shown in my E/R Diagram and create the "Personnel Emergency Vehicle Shelter" table using the primary keys from the other three tables as a foreign key.
http://img7.imageshack.us/img7/6443/dynamicenies.png
notepad+ doesn't have anything for Oracle only SQL.
drop table emergency_vehicle;
create table emergency_vehicle(
e_veh_ID varchar2(8) primary key,
e_veh_plate varchar2(8),
e_veh_registered_owner varchar2(50),
e_veh_make varchar2(50),
e_veh_model varchar2(50)
insert into emergency_vehicle values
('veh00001','ABA12345','General Hospital','FORD','E-350');
insert into emergency_vehicle values
('veh00002','ANA56844','General Hospital','FORD','E-350');
insert into emergency_vehicle values
('veh00003','TEST8408','City Fire Department','MACK','Model 95');
insert into emergency_vehicle values
('veh00004','EMRGNCEE','City Police Department','Dodge','Charger');
select * from emergency_vehicle;
drop table shelter;
create table shelter(
shelter_ID varchar2(8) primary key,
shelter_location varchar2(100),
shelter_description varchar2(50),
insert into shelter values
('she00001','1660 Main Street','This is the General hospital for the city');
insert into shelter values
('she00002',’100 Wayne Drive’,’Red Cross location #808’);
insert into shelter values
('she00003',’3000 Jefferson Place’,’Red Cross shelter #321’);
select * from shelter;
drop table first_responders;
create table first_responders(
first_responder_ID varchar2(8) primary key,
first_responder_name varchar2(50),
first_responder_function varchar2(50),
insert into first_responders values
('FRP00001',’Jack Smith’,’EMT’);
insert into first_responders values
('FRP00002',’Officer Kimble’,’Police Officer’);
insert into first_responders values
('FRP00003',’John Matthews’,’Firemen’);
select * from first_responder;
Using this code
drop table emergency_vehicle;
create table emergency_vehicle(
e_veh_ID varchar2(8) primary key,
e_veh_plate varchar2(8),
e_veh_registered_owner varchar2(50),
e_veh_make varchar2(50),
e_veh_model varchar2(50)
insert into emergency_vehicle values
('veh00001','ABA12345','General Hospital','FORD','E-350');
insert into emergency_vehicle values
('veh00002','ANA56844','General Hospital','FORD','E-350');
insert into emergency_vehicle values
('veh00003','TEST8408','City Fire Department','MACK','Model 95');
insert into emergency_vehicle values
('veh00004','EMRGNCEE','City Police Department','Dodge','Charger');
select * from emergency_vehicle;
drop table shelter;
create table shelter(
shelter_ID varchar2(8) primary key,
shelter_location varchar2(100),
shelter_description varchar2(50)
insert into shelter values('she00001','1660 Main Street','This is the General hospital for the city');
insert into shelter values('she00002',’100 Wayne Drive’,’Red Cross location #808’);
insert into shelter values('she00003',’3000 Jefferson Place’,’Red Cross shelter #321’);
select * from shelter;
drop table first_responders;
create table first_responders(
first_responder_ID varchar2(8) primary key,
first_responder_name varchar2(50),
first_responder_function varchar2(50)
insert into first_responders values('FRP00001',’Jack Smith’,’EMT’);
insert into first_responders values('FRP00002',’Officer Kimble’,’Police Officer’);
insert into first_responders values('FRP00003',’John Matthews’,’Firemen’);
select * from first_responder;
generates these results
Table dropped.
Table created.
1 row created.
1 row created.
1 row created.
1 row created.
E_VEH_ID E_VEH_PLATE E_VEH_REGISTERED_OWNER E_VEH_MAKE E_VEH_MODEL
veh00001 ABA12345 General Hospital FORD E-350
veh00002 ANA56844 General Hospital FORD E-350
veh00003 TEST8408 City Fire Department MACK Model 95
veh00004 EMRGNCEE City Police Department Dodge Charger
Table dropped.
Table created.
1 row created.
insert into shelter values('she00002',’100 Wayne Drive’,’Red Cross location #808’)
ERROR at line 1:
ORA-00911: invalid character
insert into shelter values('she00003',’3000 Jefferson Place’,’Red Cross shelter #321’)
ERROR at line 1:
ORA-00911: invalid character
SHELTER_ID SHELTER_LOCATION SHELTER_DESCRIPTION
she00001 1660 Main Street This is the General hospital for the city
drop table first_responders
ERROR at line 1:
ORA-00942: table or view does not exist
Table created.
('FRP00001',’Jack Smith’,’EMT’)
ERROR at line 2:
ORA-00911: invalid character
('FRP00002',’Officer Kimble’,’Police Officer’)
ERROR at line 2:
ORA-00911: invalid character
('FRP00003',’John Matthews’,’Firemen’)
ERROR at line 2:
ORA-00911: invalid character
no rows selected
Now I don't even see anything for the 2nd or 3rd entry on first table, and nothing for 3rd Table
Edited by: 875149 on Jul 26, 2011 2:48 PM
Similar Messages
-
HR table creation script...{SOLV}
Hi ,
Where can i download the script for the tables of HR schema....
I have found only the following to be installed in ORACLE_HOME\demo\schema
file:mkplug.sql
PROMPT Creating sequences, views, procedures and objects privileges for HR ...
SELECT TO_CHAR(systimestamp, 'YYYYMMDD HH:MI:SS') FROM dual;
CONNECT hr/&&password_hr;
-- Sequences
CREATE SEQUENCE locations_seq
START WITH 3300
INCREMENT BY 100
MAXVALUE 9900
NOCACHE
NOCYCLE;
CREATE SEQUENCE departments_seq
START WITH 280
INCREMENT BY 10
MAXVALUE 9990
NOCACHE
NOCYCLE;
CREATE SEQUENCE employees_seq
START WITH 207
INCREMENT BY 1
NOCACHE
NOCYCLE;
-- Views
CREATE OR REPLACE VIEW emp_details_view
(employee_id,
job_id,
manager_id,
department_id,
location_id,
country_id,
first_name,
last_name,
salary,
commission_pct,
department_name,
job_title,
city,
state_province,
country_name,
region_name)
AS SELECT
e.employee_id,
e.job_id,
e.manager_id,
e.department_id,
d.location_id,
l.country_id,
e.first_name,
e.last_name,
e.salary,
e.commission_pct,
d.department_name,
j.job_title,
l.city,
l.state_province,
c.country_name,
r.region_name
FROM
employees e,
departments d,
jobs j,
locations l,
countries c,
regions r
WHERE e.department_id = d.department_id
AND d.location_id = l.location_id
AND l.country_id = c.country_id
AND c.region_id = r.region_id
AND j.job_id = e.job_id
WITH READ ONLY;
-- Rebuilding procedural objects
@?/demo/schema/human_resources/hr_code
and the file hr_code.sql as well... but there is not a file which creates the refferred tables....of HR
employees ,countries, locations jobs, job_history,departments.
Note: I use Db10g v.2
Thanks...
SimVery first sentence of Chapter 1, the link provided:
During a complete installation of Oracle Database, Sample Schemas can be installed automatically with the seed database. If the seed database is removed from your system, then you will need to reinstall Sample Schemas before you can duplicate the examples you find in Oracle documentation and training materials.
The first major section in the chapter:
Using the Database Configuration Assistant
When you install Oracle with the Oracle Universal Installer, the sample schemas are installed by default when you select the Basic Installation option. If you have installed your database with the Advanced Option and did not choose to install the sample schemas, you can install the Sample Schemas with the Database Configuration Assistant (DBCA). When you run DBCA, selecting the Sample Schemas option installs all five schemas (HR, OE, PM, IX, SH) in your database. -
Oracle table merge - JOIN help needed
Can someone help me with this results we want:
F_FCN_DT F_FCN_NUM F F_APPLD_DT F_APPLD_AMT F_R C_TCN_NUM
2007-08-16 54 1 2008-02-08 4.06 131 40617700776019668
2007-08-16 54 1 2008-02-08 4.06 135 40623900776014856
2007-08-16 54 1 2007-11-02 1022.08 135 60630500002011374
2007-08-16 54 1 2008-02-08 1022.08 135 30632600004003338
Below listed are the two tables and data combinations, which need to be linked in this process.
SQL> desc test11
Name Null? Type
F_FCN_DT NOT NULL CHAR(10)
F_FCN_NUM NOT NULL NUMBER(5)
F_FCN_MED_CD NOT NULL CHAR(1)
F_APPLD_DT NOT NULL CHAR(10)
F_APPLD_AMT NOT NULL NUMBER(13,2)
F_RSN_CD NOT NULL CHAR(3)
SQL> select * from test11;
F_FCN_DT F_FCN_NUM F F_APPLD_DT F_APPLD_AMT F_R
2007-08-16 54 1 2008-02-08 4.06 131
2007-08-16 54 1 2008-02-08 4.06 135
2007-08-16 54 1 2007-11-02 1022.08 135
2007-08-16 54 1 2008-02-08 1022.08 135
SQL> desc test12
Name Null? Type
F_FCN_DT NOT NULL CHAR(10)
F_FCN_NUM NOT NULL NUMBER(9)
F_FCN_MED_CD NOT NULL CHAR(1)
F_APPLD_AMT NOT NULL NUMBER(23,6)
C_TCN_NUM NOT NULL CHAR(17)
SQL> select * from test12;
F_FCN_DT F_FCN_NUM F F_APPLD_AMT C_TCN_NUM
2007-08-16 54 1 4.06 40617700776019668
2007-08-16 54 1 4.06 40623900776014856
2007-08-16 54 1 1022.08 60630500002011374
2007-08-16 54 1 1022.08 30632600004003338Hi,
If you don't care which row from test11 gets paired with which row from test12 (as long as they're in the same group), then use the analytic ROW_NUMBER function to assign arbitrary ids to each row within each group, and add that id to the join condition, like this:
WITH test11_plus AS
SELECT f_fcn_dt, f_fcn_num, f, f_appld_dt, f_appld_amt, f_r -- or whatever you need
, ROW_NUMBER () OVER ( PARTITION BY f_fcn_dt, f_fcn_num, f, f_appld_amt -- common columns only
ORDER BY NULL
) AS r_num
FROM test11
, test12_plus AS
SELECT f_fcn_dt, f_fcn_num, f, f_appld_amt, c_tcn_num -- or whatever you need
, ROW_NUMBER () OVER ( PARTITION BY f_fcn_dt, f_fcn_num, f, f_appld_amt -- common columns only
ORDER BY NULL
) AS r_num
FROM test11
SELECT p11.* -- Or list everything except r_num
, p12.c_tcn_num
FROM test11_plus p11
JOIN test12_plus p12 ON p11.f_fcn_dt = p12.f_fcn_dt
AND p11.f_fcn_num = p12.f_fcn_num
AND p11.f = p12.f
AND p11.f_appld_amt = p12.f_appld_amt
AND p11.r_num = p12.r_num
;If the number of rows in the two tables may be different, then you may need an outer join. -
Bad file is not created during the external table creation.
Hello Experts,
I have created a script for external table in Oracle 10g DB. Everything is working fine except it does not create the bad file, But it creates the log file. I Cann't figure out what is the issue. Because my shell scripts is failing and the entire program is failing. I am attaching the table creation script and the shell script where it is refering and the error. Kindly let me know if something is missing. Thanks in advance
Table Creation Scripts:_-------------------------------
create table RGIS_TCA_DATA_EXT
guid VARCHAR2(250),
badge VARCHAR2(250),
scheduled_store_id VARCHAR2(250),
parent_event_id VARCHAR2(250),
event_id VARCHAR2(250),
organization_number VARCHAR2(250),
customer_number VARCHAR2(250),
store_number VARCHAR2(250),
inventory_date VARCHAR2(250),
full_name VARCHAR2(250),
punch_type VARCHAR2(250),
punch_start_date_time VARCHAR2(250),
punch_end_date_time VARCHAR2(250),
event_meet_site_id VARCHAR2(250),
vehicle_number VARCHAR2(250),
vehicle_description VARCHAR2(250),
vehicle_type VARCHAR2(250),
is_owner VARCHAR2(250),
driver_passenger VARCHAR2(250),
mileage VARCHAR2(250),
adder_code VARCHAR2(250),
bonus_qualifier_code VARCHAR2(250),
store_accuracy VARCHAR2(250),
store_length VARCHAR2(250),
badge_input_type VARCHAR2(250),
source VARCHAR2(250),
created_by VARCHAR2(250),
created_date_time VARCHAR2(250),
updated_by VARCHAR2(250),
updated_date_time VARCHAR2(250),
approver_badge_id VARCHAR2(250),
approver_name VARCHAR2(250),
orig_guid VARCHAR2(250),
edit_type VARCHAR2(250)
organization external
type ORACLE_LOADER
default directory ETIME_LOAD_DIR
access parameters
RECORDS DELIMITED BY NEWLINE
BADFILE ETIME_LOAD_DIR:'tstlms.bad'
LOGFILE ETIME_LOAD_DIR:'tstlms.log'
READSIZE 1048576
FIELDS TERMINATED BY '|'
MISSING FIELD VALUES ARE NULL(
GUID
,BADGE
,SCHEDULED_STORE_ID
,PARENT_EVENT_ID
,EVENT_ID
,ORGANIZATION_NUMBER
,CUSTOMER_NUMBER
,STORE_NUMBER
,INVENTORY_DATE char date_format date mask "YYYYMMDD HH24:MI:SS"
,FULL_NAME
,PUNCH_TYPE
,PUNCH_START_DATE_TIME char date_format date mask "YYYYMMDD HH24:MI:SS"
,PUNCH_END_DATE_TIME char date_format date mask "YYYYMMDD HH24:MI:SS"
,EVENT_MEET_SITE_ID
,VEHICLE_NUMBER
,VEHICLE_DESCRIPTION
,VEHICLE_TYPE
,IS_OWNER
,DRIVER_PASSENGER
,MILEAGE
,ADDER_CODE
,BONUS_QUALIFIER_CODE
,STORE_ACCURACY
,STORE_LENGTH
,BADGE_INPUT_TYPE
,SOURCE
,CREATED_BY
,CREATED_DATE_TIME char date_format date mask "YYYYMMDD HH24:MI:SS"
,UPDATED_BY
,UPDATED_DATE_TIME char date_format date mask "YYYYMMDD HH24:MI:SS"
,APPROVER_BADGE_ID
,APPROVER_NAME
,ORIG_GUID
,EDIT_TYPE
location (ETIME_LOAD_DIR:'tstlms.dat')
reject limit UNLIMITED;
_***Shell Script*:*----------------_*
version=1.0
umask 000
DATE=`date +%Y%m%d%H%M%S`
TIME=`date +"%H%M%S"`
SOURCE=`hostname`
fcp_login=`echo $1|awk '{print $3}'|sed 's/"//g'|awk -F= '{print $2}'`
fcp_reqid=`echo $1|awk '{print $2}'|sed 's/"//g'|awk -F= '{print $2}'`
TXT1_PATH=/home/ac1/oracle/in/tsdata
TXT2_PATH=/home/ac2/oracle/in/tsdata
ARCH1_PATH=/home/ac1/oracle/in/tsdata
ARCH2_PATH=/home/ac2/oracle/in/tsdata
DEST_PATH=/home/custom/sched/in
PROGLOG=/home/custom/sched/logs/rgis_tca_to_tlms_create.sh.log
PROGNAME=`basename $0`
PROGPATH=/home/custom/sched/scripts
cd $TXT2_PATH
FILELIST2="`ls -lrt tstlmsedits*.dat |awk '{print $9}'`"
NO_OF_FILES2="`ls -lrt tstlmsedits*.dat |awk '{print $9}'|wc -l`"
$DEST_PATH/tstlmsedits.dat for i in $FILELIST2
do
cat $i >> $DEST_PATH/tstlmsedits.dat
printf "\n" >> $DEST_PATH/tstlmsedits.dat
mv $i $i.$DATE
#mv $i $TXT2_PATH/test/.
mv $i.$DATE $TXT2_PATH/test/.
done
if test $NO_OF_FILES2 -eq 0
then
echo " no tstlmsedits.dat file exists " >> $PROGLOG
else
echo "created dat file tstlmsedits.dat at $DATE" >> $PROGLOG
echo "-------------------------------------------" >> $PROGLOG
fi
NO_OF_FILES1="`ls -lrt tstlms*.dat |awk '{print $9}'|wc -l`"
FILELIST1="`ls -lrt tstlms*.dat |awk '{print $9}'`"
$DEST_PATH/tstlms.datfor i in $FILELIST1
do
cat $i >> $DEST_PATH/tstlms.dat
printf "\n" >> $DEST_PATH/tstlms.dat
mv $i $i.$DATE
# mv $i $TXT2_PATH/test/.
mv $i.$DATE $TXT2_PATH/test/.
done
if test $NO_OF_FILES1 -eq 0
then
echo " no tstlms.dat file exists " >> $PROGLOG
else
echo "created dat file tstlms.dat at $DATE" >> $PROGLOG
fi
cd $TXT1_PATH
FILELIST3="`ls -lrt tstlmsedits*.dat |awk '{print $9}'`"
NO_OF_FILES3="`ls -lrt tstlmsedits*.dat |awk '{print $9}'|wc -l`"
$DEST_PATH/tstlmsedits.datfor i in $FILELIST3
do
cat $i >> $DEST_PATH/tstlmsedits.dat
printf "\n" >> $DEST_PATH/tstlmsedits.dat
mv $i $i.$DATE
#mv $i $TXT1_PATH/test/.
mv $i.$DATE $TXT1_PATH/test/.
done
if test $NO_OF_FILES3 -eq 0
then
echo " no tstlmsedits.dat file exists " >> $PROGLOG
else
echo "created dat file tstlmsedits.dat at $DATE" >> $PROGLOG
echo "-------------------------------------------" >> $PROGLOG
fi
NO_OF_FILES4="`ls -lrt tstlms*.dat |awk '{print $9}'|wc -l`"
FILELIST4="`ls -lrt tstlms*.dat |awk '{print $9}'`"
$DEST_PATH/tstlms.datfor i in $FILELIST4
do
cat $i >> $DEST_PATH/tstlms.dat
printf "\n" >> $DEST_PATH/tstlms.dat
mv $i $i.$DATE
# mv $i $TXT1_PATH/test/.
mv $i.$DATE $TXT1_PATH/test/.
done
if test $NO_OF_FILES4 -eq 0
then
echo " no tstlms.dat file exists " >> $PROGLOG
else
echo "created dat file tstlms.dat at $DATE" >> $PROGLOG
fi
#connecting to oracle to generate bad files
sqlplus -s $fcp_login<<EOF
select count(*) from rgis_tca_data_ext;
select count(*) from rgis_tca_data_history_ext;
exit;
EOF
#counting the records in files
tot_rec_in_tstlms=`wc -l $DEST_PATH/tstlms.dat | awk ' { print $1 } '`
tot_rec_in_tstlmsedits=`wc -l $DEST_PATH/tstlmsedits.dat | awk ' { print $1 } '`
tot_rec_in_tstlms_bad=`wc -l $DEST_PATH/tstlms.bad | awk ' { print $1 } '`
tot_rec_in_tstlmsedits_bad=`wc -l $DEST_PATH/tstlmsedits.bad | awk ' { print $1 } '`
#updating log table
echo "pl/sql block started"
sqlplus -s $fcp_login<<EOF
define tot_rec_in_tstlms = '$tot_rec_in_tstlms';
define tot_rec_in_tstlmsedits = '$tot_rec_in_tstlmsedits';
define tot_rec_in_tstlms_bad = '$tot_rec_in_tstlms_bad';
define tot_rec_in_tstlmsedits_bad='$tot_rec_in_tstlmsedits_bad';
define fcp_reqid ='$fcp_reqid';
declare
l_tstlms_file_id number := null;
l_tstlmsedits_file_id number := null;
l_tot_rec_in_tstlms number := 0;
l_tot_rec_in_tstlmsedits number := 0;
l_tot_rec_in_tstlms_bad number := 0;
l_tot_rec_in_tstlmsedits_bad number := 0;
l_request_id fnd_concurrent_requests.request_id%type;
l_start_date fnd_concurrent_requests.actual_start_date%type;
l_end_date fnd_concurrent_requests.actual_completion_date%type;
l_conc_prog_name fnd_concurrent_programs.concurrent_program_name%type;
l_requested_by fnd_concurrent_requests.requested_by%type;
l_requested_date fnd_concurrent_requests.request_date%type;
begin
--getting concurrent request details
begin
SELECT fcp.concurrent_program_name,
fcr.request_id,
fcr.actual_start_date,
fcr.actual_completion_date,
fcr.requested_by,
fcr.request_date
INTO l_conc_prog_name,
l_request_id,
l_start_date,
l_end_date,
l_requested_by,
l_requested_date
FROM fnd_concurrent_requests fcr, fnd_concurrent_programs fcp
WHERE fcp.concurrent_program_id = fcr.concurrent_program_id
AND fcr.request_id = &fcp_reqid; --fnd_global.conc_request_id();
exception
when no_data_found then
fnd_file.put_line(fnd_file.log, 'Error:RGIS_TCA_TO_TLMS_CREATE.sh');
fnd_file.put_line(fnd_file.log, 'No data found for request_id');
fnd_file.put_line(fnd_file.log, sqlerrm);
raise_application_error(-20001,
'Error occured when executing RGIS_TCA_TO_TLMS_CREATE.sh ' ||
sqlerrm);
when others then
fnd_file.put_line(fnd_file.log, 'Error:RGIS_TCA_TO_TLMS_CREATE.sh');
fnd_file.put_line(fnd_file.log,
'Error occured when retrieving request_id request_id');
fnd_file.put_line(fnd_file.log, sqlerrm);
raise_application_error(-20001,
'Error occured when executing RGIS_TCA_TO_TLMS_CREATE.sh ' ||
sqlerrm);
end;
--calling ins_or_upd_tca_process_log to update log table for tstlms.dat file
begin
rgis_tca_to_tlms_process.ins_or_upd_tca_process_log
(l_tstlms_file_id,
'tstlms.dat',
l_conc_prog_name,
l_request_id,
l_start_date,
l_end_date,
&tot_rec_in_tstlms,
&tot_rec_in_tstlms_bad,
null,
null,
null,
null,
null,
null,
null,
l_requested_by,
l_requested_date,
null,
null,
null,
null,
null);
exception
when others then
fnd_file.put_line(fnd_file.log, 'Error:RGIS_TCA_TO_TLMS_CREATE.sh');
fnd_file.put_line(fnd_file.log,
'Error occured when executing rgis_tca_to_tlms_process.ins_or_upd_tca_process_log for tstlms file');
fnd_file.put_line(fnd_file.log, sqlerrm);
end;
--calling ins_or_upd_tca_process_log to update log table for tstlmsedits.dat file
begin
rgis_tca_to_tlms_process.ins_or_upd_tca_process_log
(l_tstlmsedits_file_id,
'tstlmsedits.dat',
l_conc_prog_name,
l_request_id,
l_start_date,
l_end_date,
&tot_rec_in_tstlmsedits,
&tot_rec_in_tstlmsedits_bad,
null,
null,
null,
null,
null,
null,
null,
l_requested_by,
l_requested_date,
null,
null,
null,
null,
null);
exception
when others then
fnd_file.put_line(fnd_file.log, 'Error:RGIS_TCA_TO_TLMS_CREATE.sh');
fnd_file.put_line(fnd_file.log,
'Error occured when executing rgis_tca_to_tlms_process.ins_or_upd_tca_process_log for tstlmsedits file');
fnd_file.put_line(fnd_file.log, sqlerrm);
end;
end;
exit;
EOF
echo "rgis_tca_to_tlms_process.sql started"
sqlplus -s $fcp_login @$SCHED_TOP/sql/rgis_tca_to_tlms_process.sql $fcp_reqid
exit;
echo "rgis_tca_to_tlms_process.sql ended"
_**Error:*----------------------------------*_
RGIS Scheduling: Version : UNKNOWN
Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
TCATLMS module: TCA To TLMS Import Process
Current system time is 18-AUG-2011 06:13:27
COUNT(*)
16
COUNT(*)
25
wc: cannot open /home/custom/sched/in/tstlms.bad
wc: cannot open /home/custom/sched/in/tstlmsedits.bad
pl/sql block started
old 33: AND fcr.request_id = &fcp_reqid; --fnd_global.conc_request_id();
new 33: AND fcr.request_id = 18661823; --fnd_global.conc_request_id();
old 63: &tot_rec_in_tstlms,
new 63: 16,
old 64: &tot_rec_in_tstlms_bad,
new 64: ,
old 97: &tot_rec_in_tstlmsedits,
new 97: 25,
old 98: &tot_rec_in_tstlmsedits_bad,
new 98: ,
ERROR at line 64:
ORA-06550: line 64, column 4:
PLS-00103: Encountered the symbol "," when expecting one of the following:
( - + case mod new not null others <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum variance
execute forall merge time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe
<an alternatively-quoted string literal with character set specification>
<an alternatively-q
ORA-06550: line 98, column 4:
PLS-00103: Encountered the symbol "," when expecting one of the following:
( - + case mod new not null others <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql st
rgis_tca_to_tlms_process.sql started
old 12: and concurrent_request_id = '&1';
new 12: and concurrent_request_id = '18661823';
old 18: and concurrent_request_id = '&1';
new 18: and concurrent_request_id = '18661823';
old 22: rgis_tca_to_tlms_process.run_tca_data(l_tstlms_file_id,&1);
new 22: rgis_tca_to_tlms_process.run_tca_data(l_tstlms_file_id,18661823);
old 33: rgis_tca_to_tlms_process.run_tca_data_history(l_tstlmsedits_file_id,&1);
new 33: rgis_tca_to_tlms_process.run_tca_data_history(l_tstlmsedits_file_id,18661823);
old 44: rgis_tca_to_tlms_process.send_tca_email('TCATLMS',&1);
new 44: rgis_tca_to_tlms_process.send_tca_email('TCATLMS',18661823);
declare
ERROR at line 1:
ORA-20001: Error occured when executing RGIS_TCA_TO_TLMS_PROCESS.sql ORA-01403:
no data found
ORA-06512: at line 59
Executing request completion options...
------------- 1) PRINT -------------
Printing output file.
Request ID : 18661823
Number of copies : 0
Printer : noprint
Finished executing request completion options.
Concurrent request completed successfully
Current system time is 18-AUG-2011 06:13:29
---------------------------------------------------------------------------Hi,
Check the status of the batch in SM35 transaction.
if the batch is locked by mistake or any other error, now you can release it and aslo you can process again.
To Release -Shift+F4.
Also you can analyse the job status through F2 button.
Bye -
following is the table creation script with partition
CREATE TABLE customer_entity_temp (
BRANCH_ID NUMBER (4),
ACTIVE_FROM_YEAR VARCHAR2 (4),
ACTIVE_FROM_MONTH VARCHAR2 (3),
partition by range (ACTIVE_FROM_YEAR,ACTIVE_FROM_MONTH)
(partition yr7_1999 values less than ('1999',TO_DATE('Jul','Mon')),
partition yr12_1999 values less than ('1999',TO_DATE('Dec','Mon')),
it gives an error
ORA-14036: partition bound value too large for column
but if I increase the size of the ACTIVE_FROM_MONTH column to 9 , the script works and creates the table. Why is it so ?
Also, by creating a table in this way and populating the table data in their respective partitions, all rows with month less than "JULY" will go in yr7_1999 partition and all rows with month value between "JUL" and "DEC" will go in the second partition yr12_1999 , where will the data with month value equal to "DEC" go?
Plz help me in solving this problem
thanks n regards
MoloyHi,
You declared ACTIVE_FROM_MONTH VARCHAR2 (3) and you try to check it against a date in your partitionning clause:TO_DATE('Jul','Mon')so you should first check your data model and what you are trying to achieve exactly.
With such a partition decl, you will not be able to insert dates from december 1998 included and onward. The values are stricly less than (<) not less or equal(<=) hence such lines can't be inserted. I'd advise you to check the MAXVALUE value jocker and the ENABLE ROW MOVEMENT partitionning clause.
Regards,
Yoann. -
Can we get database creation script using any packages?
Hi Friends,
we will get table creation script using dbms_metadata.get_ddl package. just like that is there any way to get database creation script? i know that we can add some lines to controlfile trace to convert it into database creation script. but i would like to know whether it is possible through packages?
thanks in advance.I think there's no package to use it for getting database creation script. But anyway, you can search it in [Oracle Database PL/SQL Packages and Types Reference|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/toc.htm]
Kamran Agayev A. (10g OCP)
http://kamranagayev.wordpress.com
[Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/] -
Using an MS Excel like template for data entry into an Oracle table
Does anybody know of a way, or development tool, that has the look and feel of MS Excel but can be used for data entry and be saved to an Oracle table and be embedded into a JSP page? I am currently using iSupport and have a need to allow users to enter data into an MS Excel like template, once the user saves the service request I need for the values to be saved in the attribute fields of the service request. I need the ability to map the cells of the template to the fields in the Oracle table. Any help would be greatly appreciated. Thanks in advance.
An Excel spreadsheet may be stored in database table .
http://www.oracle.com/technology/pub/articles/saternos_tables.html -
Copy data from Berkeley DB to Oracle tables
Hello
I need to get data from Berkeley DB to Oracle tables.
Any help/tools to this?
Thanks for your help in advance.
So far
1. I asked developers to dump BDB in flat file.
2. Created external tables & loaded into permanent table using CTAS.
CheersHi Shekhar,
External tables managed by the Oracle DB Server are a way to go.
However, I would suggest using any of the Berkeley DB Core APIs (C, C++, Java) along with its appropriate correspondent on the Oracle DB side, that is, OCI (Oracle Call Interface, C API), OCCI (Oracle C++ Call Interface) and, respectively, JDBC or SQLJ. You may also use the Oracle DB Precompilers, Pro*C/C++ along with the correspondent Berkeley DB API, C/C++.
If you have Metalink access, you may consult the KM Note 756126.1, where I've discussed how to import Oracle DB data into Berkeley DB databases (the opposite of what you're trying to do), using OCI on the Oracle DB side and the C API on the Berkeley DB side; there is a code example in the note to explain how to perform this task.
Doing the data copying the other way around is not difficult; you'll need to iterate through the Berkeley DB database with a cursor and use appropriate OCI DML statements (INSERT INTO) to write the data to the Oracle DB table. Note that you may also use OCI to execute the DDL statements (CREATE TABLE) to create the Oracle DB table into which data will be copied, or do that separately using SQL*Plus, PL/SQL dynamic native SQL etc before copying the data.
Bellow are the links for the Berkeley DB documentation page where you'll find each of the BDB APIs and the Oracle DB Application Development documentation section where you'll find the development guides for Oracle Call Interface, JDBC and SQLJ:
[Oracle Berkeley DB|http://www.oracle.com/technology/documentation/berkeley-db/db/index.html]
[Oracle DB Application Development|http://www.oracle.com/pls/db102/portal.portal_db?selected=5]
Best regards,
Andrei -
Retrieve all user id's from LDAP directory and populate in Oracle table.
Guys,
We've implemented LDAP authentication functionality in our application using Oracle's dbms_ldap package objects.
Now,Is there any way that I can retrieve all user ids from the LDAP directory and store in an Oracle table?
The distinguished name of authorized user as it appears in our LDAP directory is below:
dn=uid=ab0472,ou=people,ou=xyz,o=world.
Now I need to fetch all users uid's from the LDAP directory and populate in an Oracle table.Can somone help me with thoughts.
Thanks,
BhagatHave a look at attachments API, since this also does the same thing except that it puts the file in fnd_lobs instead of the custom table.
Thanks
Tapash -
Hello Gurus,
We are building a new application and identified that few tables will be accesses very frequently. To decrease I/O we are planning to CACHE these tables. I am not sure if we made right decision. My question what are the things you need to consider before caching Oracle tables.
Any help greatly appreciated. Thanks.
select * from V$VERSIONBANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - ProductionOK, so you want to use multiple buffer pools and to put these tables into the keep pool?
Why do you believe that this will improve performance? Oracle's default algorithm for aging out blocks that are seldomly used is pretty good for the vast majority of applications. Why do you believe that you can identify what blocks will most benefit from caching better than Oracle? Why do you believe that you wouldn't be better off giving whatever KEEP pool cache size you would allocate to the DEFAULT pool and letting Oracle's cache algorithm cache whatever it determines is appropriate? It is possible that there is something that you know about your application that allows you to make this sort of determination. But in the vast majority of cases I've seen, people that have tried to do so end up hurting performance at least a little because they're forcing Oracle at the margin to age out blocks that it would benefit from caching and to cache blocks that it would benefit from aging out.
Do you understand the maintenance impact of using multiple buffer caches? If you are using a vaguely recent version of Oracle and using any of the automatic memory management features, Oracle does not automatically manage the non-default buffer caches. That increases the probability that using non-default buffer caches is going to create performance problems since humans are much less efficient at recognizing and reacting to changing memory utilization and substantially increases the amount of monitoring and work that the DBAs need to do on the system (which, in turn, increases the risk that they make a mistake).
Justin -
Hi All,
I need to get the "Creation Script" of the existing table using c# and without using SMO dlls (is it possible? I don't know).
I.e. In SQL Management Studio -> right click on any table -> Script table as -> Create To - > open in the new query editor window. This will give you the schema of the table with the constraints of the table.
For E.g. In Northwind database, for the table "Categories", I would like to get it as show below
USE [Northwind]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Categories](
[CategoryID] [int] IDENTITY(1,1) NOT NULL,
[CategoryName] [nvarchar](15) NOT NULL,
[Description] [ntext] NULL,
[Picture] [image] NULL,
CONSTRAINT [PK_Categories] PRIMARY KEY CLUSTERED
[CategoryID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
I would like to get the same schema using c#. Please help.
Thanks & Regards,
Kalai.SMO is the easiest way to get this. This is what Management Studio uses. If you can't use SMO, get a Profiler trace of the queries that SMO executes when generating the script and execute the same using ADO.NET.
Regards,
Farooq Mahmud
Support Escalation Engineer
• Microsoft Health Solutions Group -
Using FDM to load data from oracle table (Integration Import Script)
Hi,
I am using Integration Import Script to load data from oracle table to worktables in FDM.
i am getting following error while running the script.
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done
Attaching the full error report
ERROR:
Code............................................. -2147217887
Description...................................... Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
At line: 22
Procedure........................................ clsImpProcessMgr.fLoadAndProcessFile
Component........................................ upsWObjectsDM
Version.......................................... 1112
Thread........................................... 6260
IDENTIFICATION:
User............................................. ******
Computer Name.................................... *******
App Name......................................... FDMAPP
Client App....................................... WebClient
CONNECTION:
Provider......................................... ORAOLEDB.ORACLE
Data Server......................................
Database Name.................................... DBNAME
Trusted Connect.................................. False
Connect Status.. Connection Open
GLOBALS:
Location......................................... SCRTEST
Location ID...................................... 750
Location Seg..................................... 4
Category......................................... FDM ACTUAL
Category ID...................................... 13
Period........................................... Jun - 2011
Period ID........................................ 6/30/2011
POV Local........................................ True
Language......................................... 1033
User Level....................................... 1
All Partitions................................... True
Is Auditor....................................... False
I am using the following script
Function ImpScrTest(strLoc, lngCatKey, dblPerKey, strWorkTableName)
'Oracle Hyperion FDM Integration Import Script:
'Created By: Dhananjay
'Date Created: 1/17/2012 10:29:53 AM
'Purpose:A test script to import data from Oracle EBS tables
Dim cnSS 'ADODB.Connection
Dim strSQL 'SQL string
Dim rs 'Recordset
Dim rsAppend 'tTB table append rs object
'Initialize objects
Set cnSS = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
Set rsAppend = DW.DataAccess.farsTable(strWorkTableName)
'Connect to SQL Server database
cnss.open "Provider=OraOLEDB.Oracle.1;Data Source= +server+;Initial Catalog= +catalog+;User ID= +uid+;Password= +pass+"
'Create query string
strSQL = "Select AMOUNT,DESCRIPTION,ACCOUNT,ENTITY FROM +catalog+.TEST_TMP"
'Get data
rs.Open strSQL, cnSS
'Check for data
If rs.bof And rs.eof Then
RES.PlngActionType = 2
RES.PstrActionValue = "No Records to load!"
Exit Function
End If
'Loop through records and append to tTB table in location’s DB
If Not rs.bof And Not rs.eof Then
Do While Not rs.eof
rsAppend.AddNew
rsAppend.Fields("PartitionKey") = RES.PlngLocKey
rsAppend.Fields("CatKey") = RES.PlngCatKey
rsAppend.Fields("PeriodKey") = RES.PdtePerKey
rsAppend.Fields("DataView") = "YTD"
rsAppend.Fields("CalcAcctType") = 9
rsAppend.Fields("Amount") = rs.fields("Amount").Value
rsAppend.Fields("Desc1") = rs.fields("Description").Value
rsAppend.Fields("Account") = rs.fields("Account").Value
rsAppend.Fields("Entity") = rs.fields("Entity").Value
rsAppend.Update
rs.movenext
Loop
End If
'Records loaded
RES.PlngActionType = 6
RES.PstrActionValue = "Import successful!"
'Assign Return value
SQLIntegration = True
End Function
Please help me on this
Thanks,
Dhananjay
Edited by: DBS on Feb 9, 2012 10:21 PMHi,
I found the problem.It was because of the connection string.The format was different for oracle tables.
PFB the format
*cnss.open"Provider=OraOLEDB.Oracle.1;Data Source= servername:port/SID;Database= DB;User Id=aaaa;Password=aaaa;"*
And thanks *SH* for quick response.
So closing the thread......
Thanks,
Dhananjay -
Need help in SQL table creation
Hi All,
I created a table a month back.Now i need to create another table of the same structure.
Is there any way so dat i can get the script of the table which i created earlier and use the same to create another.
Or is there another way so that we can create a table with same structure of the existing table.
Please help.
Regards,
MohanCheck out the [DBMS_METADATA.GET_DDL|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm#i1019414] function.
Example:
SQL> SET LONG 5000
SQL> SELECT DBMS_METADATA.GET_DDL('TABLE','EMP','SCOTT') FROM DUAL;
DBMS_METADATA.GET_DDL('TABLE','EMP','SCOTT')
CREATE TABLE "SCOTT"."EMP"
( "EMPNO" NUMBER(4,0),
"ENAME" VARCHAR2(10),
"JOB" VARCHAR2(9),
"MGR" NUMBER(4,0),
"HIREDATE" DATE,
"SAL" NUMBER(7,2),
"COMM" NUMBER(7,2),
"DEPTNO" NUMBER(2,0),
CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ENABLE,
CONSTRAINT "FK_DEPTNO" FOREIGN KEY ("DEPTNO")
REFERENCES "SCOTT"."DEPT" ("DEPTNO") ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS"Edited by: Centinul on Jan 11, 2010 8:01 AM -
Map FLAT file to oracle table using 9.04 version - PLS HELP!!!!
Hello all
I am having a problem with mapping a flat file to oracle table. The validation is successful, when I go to Project/Deployment manager. Try to deploy the mapping itself and the target table. It said succesful, and the last step is another "Deploy", this one is fail. Saying could not locate the file (which is a flat file) , but it is there on the server.
I have read all the help on line and follow what they show me, but still not work
Any ideas? Please provide detail answer if you know it.
Thank in advanceHallo,
just give a rights on connector
Variant 1
1. connect to user sys
2. grant read,write on directory <connector_name> to <target_schema>;
or
Variant 2
1. as user sys or system give CREATE_ANY_DIRECTORY to <target_schema>
2. manualy make CREATE DIRECTORY <connector_name> as '<full_path_to_directory>';
and enjoy :)
PS: <connector_name> you can take from script CREATE_TABLE wisch in Generation phase was created!
Kirill -
Can Oracle 9i enable schema/table creation to be transacted?
If anyone can help with this, that would be much appreciated.
So - the server has disabled autocommit and commits/rollbacks are handled by the application. Even though this is the case, Oracle 9i is not rolling back changes that have (i) created schemas/users and/or (ii) tables.
Worse still, it seems to be performing a partial rollback - some tables in a schema are left with data and others are not.
Now, this may be caused by our server creating tables for indexing while adding data to some existing tables - that is the table definitions have auto-committed the transaction to date, also committing the table insertions/updates.
After some delving, the JDBC driver has the following method: dataDefinitionCausesTransactionCommit - for Pointbase and other databases, this returns false - for Oracle it returns true.
The questions are therefore:
1) Is there a solution with Oracle 9i that enables schema and table creation to be transacted?
2) Does Oracle 10g allow definition clauses to be transacted?Actually I believe there is a limited way to make DDL statements transaction based via the CREATE SCHEMA command.
From the 9.2 SQL manaul >>
Use the CREATE SCHEMA to create multiple tables and views and perform multiple grants in a single transaction.
To execute a CREATE SCHEMA statement, Oracle executes each included statement. If all statements execute successfully, Oracle commits the transaction. If any statement results in an error, Oracle rolls back all the statements.
<<
This may be of some limited use to you, but your process should probably be changed to track of the DDL and to undo (drop) any created objects if a rollback is issued.
HTH -- Mark D Powel --
Maybe you are looking for
-
Hi Can anyone help me resolve this problem. Thanks. AC
-
can i return my ipad 2 on the one year warrenty.... since the ipad HD came out I want to get the money for that so will apple take my ipad 2 back for that $500........ I have every thing that came with it and it still is in a brand new condition its
-
Best approach to "migrate" from BEX reports to Webi reports ?
Hello, i have read lots of documents regarding best practices on how to built webi reports and universes on top of BW. But i can't find any document about best approach, not in performance way of thinking but in best way of using reports. i mean: whe
-
Firefox always opens a new window with ad.yieldmanager
As soon as i click on an image or other views on a website firefox opens a new tab with adyieldmanager and i cant get rid of it.
-
Why are the old iPhones going for so much on ebay?
My iPhone was recently destroyed by my lawn mower, so I was looking out on ebay to see if I could find a bargain on a used one. But I see 8gb versions are going for upwards of $500 - used. That's what I paid for my 16gb brand new. What is making them