SQL & PL/SQL :: Table Creation - Facing Error ORA-02438?
Oct 18, 2012
i want to create a table to perform a task when i insert client account details in this table then check the account type is in(S,C,R) and balance should be also check when account type S then balance >=5000, account type C then balance >=10000 and account type R then balance >=5000 but when i run this query then facing error "ORA-02438: Column check constraint cannot reference other columns"
SQL> ed
Wrote file afiedt.buf
1 create table kcb_acc_tab
2 (
3 accno varchar2(20) constraint accno_pk primary key,
4 name varchar2(20) constraint name_nn not null
5 constraint name_chk check((substr(name,1,1) between 'A' and 'Z') and name=upper(name)),
[code]....
View 4 Replies
ADVERTISEMENT
Jan 10, 2013
1. How can we find out what all are the SQL Queries/Procedures/Functions/<Oracle DB Objects> are running long time and affecting the Performance in each schema. If they affecting how to resolve it?
Here Need to Display the Queries and the method to increase the performance of the query.
2. How can we find out what all are the DB links are Out Facing and In facing? ( In Each Schema)
View 8 Replies
View Related
Apr 12, 2010
I am getting compilation error when create nested table type depend on table structure
SQL> CREATE OR REPLACE TYPE typ$nttb$1 IS TABLE OF emp%rowtype
2 ;
3 /
Warning: Type created with compilation errors.
SQL> show error
Errors for TYPE TYP$NTTB$1:
LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0 PL/SQL: Compilation unit analysis terminated
1/29 PLS-00329: schema-level type has illegal reference to SCOTT.EMP
SQL>
View 5 Replies
View Related
Sep 27, 2013
I have folliwng table
CREATE TABLE abcd
(
trans_type VARCHAR2(10) nn,
original_tran_no NUMBER,
original_line_item NUMBER(20),
original_trans_dt DATE);
I have to create a constraint when trans_type = 'R'then (original_tran_no and original_trans_dt ) should be not null else can be null able; is the follwing stmt right?
alter table abcd add constraint t1_chk1
check (
( case when trans_type = 'R' then (original_tran_no is not null
and original_trans_dt is not null))
View 10 Replies
View Related
Apr 26, 2013
I have 30 packages to be created for a new user, i call in the execute_pkg.sql which creates all the 30 packages.
i use like this
sql> set echo on
sql> set spool execute_pkg_spool.txt
sql>@execute_pkg.sql
sql> spool off
My questions:
I find it difficult to figure out the which pkg was not created, at present the spool file is too big with the pkg code in it
create or replace package test1....
...
..
..
Warning: Package Body created with compilation errors.
i wanted the output like this
test1
Warning: Package Body created with compilation errors.
View 5 Replies
View Related
Nov 28, 2012
I am getting error while creating a trigger. I am not yet find any wrong statement. See the following code and comments.
SQL> CREATE OR REPLACE TRIGGER shclog_in before update on shclog for each row
WHEN (to_number(new.MSGTYPE) = 210)
2 3 declare
4 PRAGMA AUTONOMOUS_TRANSACTION;
5 begin
6 insert into starcas.transaction_log values(:new.PAN,
[code].......
Warning: Trigger created with compilation errors.
SQL> show error
Errors for TRIGGER SHCLOG_IN:
LINE/COL ERROR
-------- -----------------------------------------------------------------
4/1 PL/SQL: SQL Statement ignored
4/21 PL/SQL: ORA-00942: table or view does not exist
SQL>
View 4 Replies
View Related
Jun 10, 2010
It's been 2 days from now that I'm bugging with this kind of error in my manual dB creation. I used DBCA first but we had a default directory settings, that's why I resorted to create the db manually. The dB was already created and currently has a status of STARTED.. I cannot mount it due to this error:
SQL> startup nomount
ORACLE instance started.
Total System Global Area 247463936 bytes
Fixed Size 2235856 bytes
Variable Size 177840688 bytes
[code]....
View 3 Replies
View Related
Jun 21, 2011
I have created a trigger in a different server and is working fine. But then when I implemented the same trigger in a different server (secured) then I'm encountering this error:
PLS-00049: bad bind variable
Below is the code for the trigger for reference:
create or replace
TRIGGER TRG_ROLE_RIGHT_HISTORY
BEFORE INSERT OR UPDATE OR DELETE ON MAS_BPI.LOS_SEC_ROLE_RIGHT_MAPPING
FOR EACH ROW
DECLARE
[code]....
View 17 Replies
View Related
Jun 25, 2012
I tried to create my EA workspace for APEX 4.2 and got the following Error.
ORA-20987: APEX - GET_BLOCK Error. - ORA-20001: Execution of the statement was unsuccessful. ORA-01653: unable to extend table APEX_040200.WWV_FLOW_PAGE_PLUGS by 1024 in tablespace APEX_REL42 <pre>declare s varchar2(32767) := null; l_clob clob; l_length number := 1; begin s := null; wwv_flow_api.create_page_plug ( p_id=> 6594522669003504543 + wwv_flow_api.g_id_offset, p_flow_id=> wwv_flow.g_flow_id, p_page_id=> 0, p_plug_name=> 'Menu', p_region_name=&g
View 14 Replies
View Related
Apr 8, 2013
While Creating database on AIX Machine using DBCA utility I am getting following error
Error Details:
-------------------------------------------------------------------------------------------------------------------
Allocating device....
Specifying datafiles...
Specifing datafiles...
Restoring ...
[code]....
View 2 Replies
View Related
Sep 16, 2011
i am creating database manually in oracle 9i os version ibm-aix5.3 it showing following error
CREATE DATABASE "varathu"
*
ERROR at line 1:
ORA-01501: CREATE DATABASE failed
ORA-00200: controlfile could not be created
ORA-00202: controlfile: '/backup/varathu/control01.ctl'
ORA-27040: skgfrcre: create error, unable to create file
IBM AIX RISC System/6000 Error: 13: Permission denied
View 18 Replies
View Related
Aug 15, 2010
I'm getting a "TNS disconnect" after database creation script creation in DBCA. Haven't figured out what's going on. I'm attempting to create a 2nd database on one linux 64 server. I get all the way through DBCA, but it won't go the final mile. Any thoughts? I've tried setting the port to a different port from the existing LISTENER, creating a LISTENER2 and associating it with the 2nd instance.
View 1 Replies
View Related
Jul 9, 2012
During ASM Disk Groups creation after the ASM instance creation, receive the following error: Disk Group ORAASMGROUP2 already exists. Cannot be created again
The Grid infrastructure was deinstall one time and still the same issue.
View 4 Replies
View Related
Apr 9, 2013
I have two tables having same name in two different databases.i have to create a new table with these two tables in a new database.
But if one table have 2 columns and another table having three columns I have to create a new table with three columns..
View 6 Replies
View Related
May 23, 2011
i had small query on external tables. i had (.csv) file outside the database. In this file, one column will be added monthly. i need to create the external table dynamically by adding the column for every month.
How the procedure can be created for this requirement.
View 9 Replies
View Related
May 23, 2009
I created a table but I want to add the Unique check to it as I forgot to apply it to the table when I created it.Is it possible to make the field Unique after having created the table or do I have to drop the table and re-create it?
View 3 Replies
View Related
Feb 25, 2012
i am trying to create table inside function where in after creating table when am trying to access the table with select statement oracle is throwing error 'Table/view doesnot exist -00942', below is the code snippet
create or replace function example (mkey in varchar2) return varchar2
is
g_key varchar2(100);
l_tbl_ntext exception;
pragma exception_init(l_tbl_ntext , -942);
begin
begin
execute immediate 'select * from example1';
exception
when l_tbl_ntext then
null;
end;
execute immediate 'create table example1(skey varchar2, g_key varchar2) storage(buffer_pool, keep)';
end example;
/
select * from example;
View 8 Replies
View Related
Feb 24, 2007
the relationship on my script.What I want to do is make it possible to assign many courses to a student.But I have read a few books on foreign keys and primary keys, and I still dont get how to go on doing this....
This is how the table creation with the keys looks right now...
CREATE TABLE CAMPUS (
CAMPUSID NUMBER(4) NOT NULL,
NAME VARCHAR2(80) NOT NULL,
CONSTRAINT CAMPUS_PK PRIMARY KEY (CAMPUSID));
[code]...
View 3 Replies
View Related
Aug 17, 2010
I need to create a temp table within a stored procedure. I want to apply some logic on the table, and then delete it when it is completed in runtime -- all inside the stored procedure.
View 13 Replies
View Related
Nov 28, 2010
I have a requirement to create the table monthly.The tablename will be the o/p of the following select query.
select 'TBR_AND_SECURITY_DEPOSIT'||TO_CHAR(sysdate, 'Monyy') from dual
I am trying to create the table for creating the backup of the existing table TBR_AND_SECURITY_DEPOSIT.
create table (select 'TBR_AND_SECURITY_DEPOSIT'||TO_CHAR(sysdate, 'Monyy') from dual) select * from TBR_AND_SECURITY_DEPOSIT
but it is throwing error as invalid table name.
View 2 Replies
View Related
May 6, 2010
I want to create a table, whose first column , patient_id, should be a sequence.
View 9 Replies
View Related
Aug 22, 2011
is it Possible to Assign the Sequence Name During the Table Creation.
View 1 Replies
View Related
Feb 20, 2012
I have table property and flat , in both of these tables I have cvp_id common colomn .Now I want to add cluster on this colomn so how can I add cluster to table which is already exists.
View 3 Replies
View Related
Apr 22, 2013
declare
vnum number;
vname varchar2(50):='t1';
begin
begin
select count(*) into vnum from dba_tables where table_name=vname;
dbms_output.put_line('table count '||vnum);
exception
when others then
vnum := 0;
end;
begin
if vnum>0 then
execute immediate 'drop table '||vname;
dbms_output.put_line('table dropped');
end if;
exception
when others then
dbms_output.put_line('table does not exists');
end;
execute immediate 'create table '||vname ||' ( n number)';
dbms_output.put_line('table created');
end;
View 14 Replies
View Related
Jul 20, 2012
Facts:
Oracle 10.1.0.5
AIX 5.3
My table, HMTX have 10 partitions each of one have 6 millions of rows (average). We have 7 partitioned LOCAL indexes in that table.
Every month we load data into a new partition (6 million of rows aprox) and drop the oldest partition in table HMTX.
In order to do that we have a script that contain the next statements:
drop of all indexes
drop index n1;
drop index n...;
drop index n7;
[Code]...
create indexes again with tha same storage and degree parameters
CREATE INDEX hmtx_TST_N1 ON hmtx (campo1, campo2, campo3 .... campo8)
TABLESPACE xxxx
PCTFREE 0
INITRANS 2
[Code]....
My problem is in rhe index creation section, despite use parallel with degree 8 and nologging the index was created in :
Elapsed: 02:43:50.85.
In past months that index was created in :
Elapsed: 01:43:36.94
Elapsed: 04:48:31.24
Elapsed: 00:57:16.28
there are another way in order speed the index creation ?? o another way to disable ths index ??
View 4 Replies
View Related
Oct 31, 2010
I have 2 tables , which can be mapped with a common column and the second table's rest of the columns should become like columns(like pivot) and in the second table itself 1 more column called value , this sum of the value becomes a value to the pivot column value. For this I am using CASE structure and I am writing the individual case for each column , but I am sure after some extent case don't work at all and I would like to do it dynamically( when ever the new entry will come into the source table , my proc has to pick automatically the new value and put the new value as part of pivot structure) , so pls share your inputs and if possible provide some sample code.
View 3 Replies
View Related
Aug 2, 2010
Check table creation script
CREATE TABLE "SCOTT"."TEST_USER"
("TX_SID" VARCHAR2(30 BYTE) NOT NULL ENABLE,
"TX_FIRST_NAME" VARCHAR2(30 BYTE) NOT NULL ENABLE,
"TX_LAST_NAME" VARCHAR2(30 BYTE) NOT NULL ENABLE,
[code]...
Here i'm loading data into these three tables through sql loader. Here is the control file
OPTIONS (SKIP=1,ROWS=5)
LOAD DATA
INFILE 'C:SQL LOADER DEMO estuser_data_lat.csv'
INTO TABLE TEST_USER
[code]...
Here are the two function which i'm calling from sql loader control file
CREATE OR REPLACE FUNCTION get_role_id(p_role_name VARCHAR2)
RETURN NUMBER IS
lv_role_id NUMBER;
BEGIN
[code]..
i'hv attached the testuser_data_lat.csv file, which is the data file.Command line
C:SQL LOADER DEMO>SQLLDR scott/sc CONTROL=rd_users_control.ctl
Now let me tell u what is happening Whem i'm running the above sqlldr, log is generating saying
Record 1: Rejected - Error on table TEST_ROLE, column ID_ROLE.
ORA-01400: cannot insert NULL into ("SCOTT"."TEST_ROLE"."ID_ROLE")
Record 2: Rejected - Error on table TEST_ROLE, column ID_ROLE.
ORA-01400: cannot insert NULL into ("SCOTT"."TEST_ROLE"."ID_ROLE")
[code]...
But when i remove
INTO TABLE TEST_ROLE(
TX_SID POSITION(1:3) CHAR,
ID_ROLE "get_role_id(:ROLE_NAME)" ,
TX_CREATED_BY CONSTANT "SYSTEM",
[code]...
from Control file, data is getting popupalated in TEST_USER and TEST_TITLE similarly if remove
INTO TABLE TEST_TITLE(
TX_SID POSITION(1:3) CHAR,
ID_TITLE "get_title_id(:TITLE_NAME)" ,
[code]...
from Control file, TEST_USER and TEST_ROLE is getting populated.
Here RD_ROLE_MASTER script
CREATE TABLE RD_ROLE_MASTER (
"ID_ROLE" NUMBER(38,0) NOT NULL ENABLE,
"TX_ROLE_NAME" VARCHAR2(20 BYTE) NOT NULL ENABLE
[code]...
Here is RD_TITLE_MASTER script
CREATE TABLE RD_TITLE_MASTER(
"ID_TITLE" NUMBER(38,0) NOT NULL ENABLE,
"TX_TITLE_NAME" VARCHAR2(25 BYTE) NOT NULL ENABLE);
Insert into RD_TITLE_MASTER (ID_TITLE,TX_TITLE_NAME) values (7,'RED_LOB_ESCALATION_L1'); what is the problem?
View 1 Replies
View Related
Feb 12, 2013
i am trying to create Procedure which will create the partitions based on the other table date values one per each day.
CREATE OR REPLACE PROCEDURE PARTITION_TEST(PART_DATE_TABLE IN VARCHAR2, TABLE_NAME IN VARCHAR2,SCHEMA_NAME IN VARCHAR2)
AS
V_PART_NM VARCHAR2(20);
V_PART_CNT NUMBER;
V_DATE DATE;
V_SCHEMA_NAME VARCHAR(15);
[Code]..
It is not creating the partitions and even not giving any errors.
View 4 Replies
View Related
Nov 7, 2013
I have a table which contains some data. But we are dropped and recreated the same table several times. Now I wanted to know that when this table created initially. How to findout the date of creation(very first time).
View 13 Replies
View Related
Sep 20, 2012
i have 1 xcel sheet in formatted data i want to import data in oracle table .. how do i do dat??
View 5 Replies
View Related