0

hello ,

(begginer of SQL)
i have to make one pro. in which

i have to use trigger which will fire before inserting into table

and convert the name into upper case but i don't what is the prob.

with the code pls provide ur suggetion

my table attributes are
stu (sno number(6),sname varchar(12),class varchar(12) );

create or replace trigger trg27

before insert on stu

for each row

declare 

	sname1 stu.sname%type;
	sno1  stu.sno%type;
	class1 stu.class%type;

	
begin

	sno1:=:new.sno;
	sname1:=:new.sname;
	sname1:=upper(sname1);
	class1:=:new.class;
						
	
	exception 

		when others then 

			dbms_output.put_line('Error is occured..!!');

	
		
	insert into stu values(sno1,sname1,class1);
					
	
end;
2
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by john_beginner
0

Try using select into

Select :NEW.sno, UPPER(:NEW.sname), :NEW.class
into sno1, sname1, class1 from dual;

Edited by cgyrob: n/a

0

Try using select into

Select :NEW.sno, UPPER(:NEW.sname), :NEW.class
into sno1, sname1, class1 from dual;

my query is , it's not convert the lower case into upper case

i have tried this code also but still the result is same !!!

0

Really not sure why upper() is not working for you.

Maybe trying using the upper() function on the insert.

INSERT INTO stu VALUES(sno1,upper(sname1),class1);
0

try assigning to a variable then select into

sname1 stu.sname%TYPE;

sname1:= :new.sname

SELECT :NEW.sno, UPPER('sname1'), :NEW.class
INTO sno1, sname1, class1 FROM dual;

Edited by cgyrob: n/a

0

i have tried above code also but still the result is same, anyways

thanx for u r help bt i have tried some other code

n my query is solved nw !!!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.