SQL & PL/SQL :: Create A Trigger With Requirement Of Achieving Primary Key Functionality?

Sep 22, 2011

I want to create a trigger with the requirement of achieving Primary key functionality.

I have a "EMP" table. the table already contains a duplicate data on "EMPNO" column. i want to restrict entering duplicate data further into table for that i want to create a trigger.

where can i find different triggering events of DML(like update, delete etc...)and DDL(database and schema level).

View 6 Replies


ADVERTISEMENT

Forms :: 6i Requirement - Create New User And Edit Existing One

Jun 10, 2011

I have a form with fields like, UserName, User ID Email Address. This is used to create new users & edit existing user information. I wanted to make the Email field mandatory. So i made the email field as 'Required' via Proerty Pallette. So when ever i create new users after this change, i get a message saying 'Field must be required' when i try to skip this email field.

However when i edit existing user information and try to save the data with no email address i am able to save. So, where when i try to save a user info with no email address, i should get a warning saying 'email address is required'. How to go about it and if i wil have to create any trigger.

View 5 Replies View Related

SQL & PL/SQL :: Trigger To Handle Primary Key Violation?

Sep 5, 2012

I am trying to handle PK violation error on a certain table, on INSERT, my best guess is I should use a trigger. The basic idea is this:

The table consists of 7 columns, and 6 of them are PK, and the seventh one is "amount". I want to handle PK violation in such way that, if it occurs during INSERT, then instead of inserting a new row, it should just update the "amount".

View 16 Replies View Related

Calculation - Flag Which Students Are Under Achieving On Their Target Grades?

Mar 5, 2008

I have a SQL link table called student_monitor containing the follwing attributes and e.g. data

student_id, Class_id, Predicted_Grade, Actual_Grade
1 1 A C
2 1 B B
3 1 C B

I need to be able to flag which students are under achieving on their target grades and dont know how to do this or the best way to do this as i cannot calculate the diff between a char?

View 1 Replies View Related

PL/SQL :: How To Create Primary Key Like W1

Jul 10, 2012

primary key should be

W1
W2
W3 like this.

1,2,3 are sequence numbers.

View 2 Replies View Related

Forms :: Create Unique Primary Key

Nov 28, 2010

A Master form in a tabular format. Id is a display item. I want to auto generate Id with following query.

select nvl(max(issue_id),0)+1 into :issue_mt.issue_id from issue_mt;

It works:

1)When each record is saved before creating new record.

It doesn't work:

2)If multiple records are entered with out saving each record.

What to do to generate unique Id in both cases?

View 7 Replies View Related

SQL & PL/SQL :: Create Primary Key Without Creating Index?

Jul 12, 2012

how to create a primary key with out creating an index?

View 10 Replies View Related

Primary Key Does Not Treat NULL Value - Can Create Statement?

Feb 21, 2012

Create table X(
var1 varchar2(20) null,
var2 varchar2(20) not null,
constraint pk_var1 primary key(var1)

We all know Primary key doesnt treat NULL as a value. But the above statement is fine to be executed without problem.
Is this something to be highlighted? or am i not right in understanding 'var1 varchar2(20) null '?

View 2 Replies View Related

SQL & PL/SQL :: Create Primary Key Using Local On Partitioned Table?

Mar 2, 2012

I have to create primary key using local on a partitioned table.

Since the table is huge it has to be done parallel. Following stmt is giving error

alter table XYZ add CONSTRAINT PKN_XYZ PRIMARY KEY (ID,LogDtTm)
USING INDEX LOCAL parallel 25 INITRANS 5 TABLESPACE OLTP_IDX_TS ;

View 5 Replies View Related

SQL & PL/SQL :: Create Normal Primary Constraint During Table Creation

Mar 23, 2010

i'm new to oracle environment.how can i specify NONCLUSTERD INDEX on Primary cloumn during table creation.By default it will create clusterd index but i need non-clusterd index on it.

I'm using following stmt to create normal primary constarint during table creation,

CONSTRAINT PKFORM_PROPS PRIMARY KEY (FORM_PROPS_PK) USING INDEX TABLESPACE DB123_INDEX

how can i change the above query, so that it should create NONCLUSTERED INDEX on Primary key column.

View 5 Replies View Related

Create A Sequence For Primary Key To Simply Auto-increment By Default Of 1

Mar 14, 2005

I'm trying to create a sequence for a primary key to simply auto-increment by the default of 1. I have a sql script written to generate mt tables, and I'm not sure how to modify the script to include the sequence. I also just want the sequence for a specific column, ie, PK, not the PK in all tables.

Here's a snippet from my script:

create table image
(
image_id int NOT NULL,
source_id int NOT NULL,
CONSTRAINT image_id_pk PRIMARY KEY (image_id),
CONSTRAINT fk_source_id FOREIGN KEY (source_id) REFERENCES source(source_id)
);

Would I add the create sequence statement right after the create table, and if so, how do I apply the sequence to only 1 table and a single column?

View 5 Replies View Related

Data Guard :: Create Control File With Standby Keyword On Primary Database

Jul 4, 2012

What is difference when you issue a create controlfile with "standby" keyword on the primary database

ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/path/db_stby.ctl';

vs. creating a control using

ALTER DATABASE BACKUP CONTROLFILE to '/path/db_control.ctl';

what does ORACLE put into the standby control that is "extra"? ie. what is the difference between a standby control file and a normal control file?

View 7 Replies View Related

Reports & Discoverer :: Stretch Column As Per Requirement?

Aug 21, 2012

How can i stretch field dynamically as per the requirement.

i use horizontal elasticity and also format trigger on the field but cant find the expected output.... How can i achieve the same...

View 2 Replies View Related

Requirement To Generate A Report Of Users And Their Different Licenses

Apr 30, 2013

I have come across a requirement to generate a report of all the users in Hyperion shared services console along with their previlages and also the different licences consumed by the users like Essbase, HFM, Hyperion Planning, Workforce planning etc.... The provisioning report in Shared services is not giving these details.

View 0 Replies View Related

SQL & PL/SQL :: How To Create The Trigger

Jan 28, 2013

how to create the trigger that count the last 7 day about from sale table if the last 7 day amount is greater then 10000 then update the commission 2% other wise do nothing

View 19 Replies View Related

PL/SQL :: Can't Create A Trigger

May 9, 2013

I cant create a trigger for the following problem "write a trigger to change the "hiredate"(in emp tale) in the default format even if the user enters it in some other format, say year/mon/date..."

View 7 Replies View Related

Forms :: Requirement To Develop A Form From Scratch Level

Aug 26, 2013

I have a requirement to develop a form from scratch level.The form contain search criteria and a search button.On pressing the search button it will display the search result just below the search criteria.The search result contain two button, EDIT and DELETE button in each row.

View 3 Replies View Related

SQL & PL/SQL :: Create Trigger For Timestamp

Aug 13, 2010

Create a trigger that stamps the date_created and the date_updated column with current date on new and updated records?

View 2 Replies View Related

Forms :: How To Create A Trigger For Age

Apr 16, 2010

How do I create a trigger for the age. I want an alert to appear when the date of birth field is less than the age of 17. The formula is age=sysdate-dateofbirth

View 11 Replies View Related

SQL & PL/SQL :: Create A Sequence In DML Trigger?

Apr 12, 2013

i would like to create a sequence inside a dml trigger. Is it possible? I created a trigger and it is compiled sucessfully.

create or replace trigger tri_update_test
after delete on test
declare
pragma autonomous_transaction;

[code]...

trigger created sucessfully.And i try to delete data from the test

delete from test where id=5;

Output:

ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "SCOTT.TRI_UPDATE_TEST", line 4
ORA-04088: error during execution of trigger 'SCOTT.TRI_UPDATE_TEST'

View 4 Replies View Related

SQL & PL/SQL :: Create A Trigger And Procedure To Go Along With DDL

May 11, 2010

I'm trying to create a trigger and procedure to go along with my DDL. Everything is created just fine, but when I try to execute an update on the table monitored by the trigger I get the following error:

update housing set group_num = 1 where room_num = 10

ERROR at line 1:
ORA-00937: not a single-group group function
ORA-06512: at "YANKEEFAN146.VIOLATION_CHK", line 6
ORA-04088: error during execution of trigger 'YANKEEFAN146.VIOLATION_CHK'

/* DDL */
create table violation_type
(violation_num number(1) primary key,
violation_def varchar2(100) not null)
organization index
tablespace mi257_data;
[code]....

View 9 Replies View Related

Create After Logon Trigger

Jun 20, 2012

I'm looking to create an after logon trigger... my question is - can this trigger be created by any user (i.e. other than sys) and - if so - what's required to ensure it fires for EVERY other user that log's on to the database?

View 2 Replies View Related

SQL & PL/SQL :: Create Table Using Trigger

Feb 1, 2013

Is it possible to create table using trigger?

I tried but failed...

CREATE OR REPLACE TRIGGER tri1
AFTER UPDATE
ON dept
FOR EACH ROW
declare
pragma AUTONOMOUS_TRANSACTION;
BEGIN
execute immediate 'create table dept_dum as select * from dept';
END;
/

SQL> update dept set deptno=23 where deptno=10;
update dept set deptno=23 where deptno=10
*
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "SCOTT.TRI1", line 6
ORA-04088: error during execution of trigger 'SCOTT.TRI1'

I am running this as scott user

My requirement is to

create table as select * from table_name where flag=1

This has to be done parallel for all the tables for which this flag is enabled and by that trigger delete all those rows which were backed up as table.

View 4 Replies View Related

Forms :: Customize Position Of ALERT Message On Screen As Per Requirement

Mar 19, 2010

I am using Oracle developer Suite 10g, and i want to customize the position of ALERT message on the screen as per requirement.

View 4 Replies View Related

Create One Trigger Before DML On All Schema Tables

Nov 28, 2011

We have an application is must be connected to our database for specific requirements in our company but this application has a very bug thing as we must write the super DB password "Like HR password as example" clear in some files and these files must be shared so developers can use the HR password to do any action !!! I know that this application is a problem but we have to install

I can do this by creating trigger on each table will restrict DML. As example: if the operating system user is XXX, the trigger restrict the action. But not logic at all to create more than 1000 triggers on schema (This will impact badly on DB performance).

So, i need to create one trigger to fire before doing any DML on all schema tables. As example: If "MMM" the administrator operating system user trying to do insert action, he can do the action. BUT If "DEV" the developer operating system user trying to do insert action, the trigger must fire here to restrict this action.

Be noted also, i need this trigger not depend on any specific tool like Toad as any user can simply rename the exe file for toad then he can pass the trigger. At least, trigger must depend on (Operating system user & Action_type)

View 11 Replies View Related

Privileges Of Create Trigger - Procedures?

Aug 16, 2013

i want to give privilege of create trigger,procedures and functions privileges to a user "A"on the schema "B". how can i do it. i've already given select,insert,update,delete privilege to user "A"

how can user "A" create trigger(etc.) on tables of user "B".

View 1 Replies View Related

Forms :: How To Create Trigger On Backend

Oct 14, 2010

I Created a form just for testing purpose [Which is i attached]

My Table is TEST0

Structure of table :
---------------------------
NOVARCHAR2(5)
NAME VARCHAR2(10)
FLG VARCHAR2(1)

My Task is When i added a record, e.g if on form, i add name - AAD But its must save on TEST0 Table like this way EMPAAD...means always concate with 'EMP'||:Block.name while saving on database..

I know how to do with front end application, but i want to achieve this task by using trigger on backend databse...how to create a Trigger on backend....i try a one trigger but it give me error- Unable to insert Record...

View 12 Replies View Related

SQL & PL/SQL :: Trigger Insert - Create Or Replace?

Jun 12, 2013

I have make a new trigger.Create a trigger that inserting a new job_id MAX_SALARY assigned as the employee's salary more than 80 departmental charges

I have that code, is that correct?

CREATE OR REPLACE
TRIGGER TR27
AFTER INSERT ON JOBS FOR EACH ROW
BEGIN
(SELECT MAX(SALARY) FROM EMPLOYEES WHERE DEPARMENT_ID=80);
:NEW.MAX_SALARY := :OLD.MAX_SALARY;
END;

What I need to complete it?

View 2 Replies View Related

SQL & PL/SQL :: Create A Trigger On Multiple Schemas

May 25, 2011

I have following schemas in my database scott,sh,hr...I created a triger on a schema scott with the following method

1. sqlplus / as sysdba

2. CREATE TABLE LOGIN_AUDIT_INFO_ALL (
operation VARCHAR2(30),
obj_owner VARCHAR2(30),
object_name VARCHAR2(30),
sql_text VARCHAR2(64),
attempt_by VARCHAR2(30),
attempt_dt DATE);

3.CREATE OR REPLACE TRIGGER login_audit_prod_schemas
AFTER CREATE OR ALTER OR DROP
ON SCOTT.SCHEMA
[code]....

But it don't fulfill my requirement. trigger is fired when scott perform any action. but my requirment is that trigger should be fired when create action is performed on scott by hr,sh or scott. i also want a single trigger which fulfill the requirement.

View 8 Replies View Related

SQL & PL/SQL :: Create A Trigger With After Logon Database?

Apr 28, 2011

i would like to trace some connexions on database, once compile the code , i have the issus following:

10/2 PL/SQL: SQL Statement ignored
11/20 PL/SQL: ORA-00942: table or view does not exist

this is the

DROP TABLE connect_user;
CREATE TABLE connect_user
(
nom_ora varchar2(15),
naom_os varchar2(15),
programme varchar2(20),
poste varchar2(20),

[code]...

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved