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;

Recommended Answers

All 6 Replies

Try using select into

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

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 !!!

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);

i have try this code also but i don't know y it's not working

( i am using oracle 8i )

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;

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 !!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.