looks very strange to me because that should work and i have not heard or went thru any links saying it would not work in 10g...
it would be better if you post your full code and the errors/exceptions you are getting.
Main Topics
Browse All Topicswhen i was upgrading from 8i to 10g one of the packages had the code..
if SQL%ROWCOUNT = 0 then
v_txt := v_program||': '||': Tables Not Created. Check!!!!;
RAISE_APPLICATION_ERROR(-2
END IF;
This failed while running in 10g database, I tried this
v_ins_row_count := SQL%ROWCOUNT;
IF v_ins_row_count = 0 THEN
v_txt := v_program||': '||': Tables Not Created. Check!!!!';
RAISE_APPLICATION_ERROR(-2
END IF;
This worked!! Do you guys know why, I dont want to change the code but looks like the current code always had sql%rowcount value as zero and it went to exception but the modified code did not..
Have you guys experienced this in 10g?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I tried SQL%ROWCOUNT < =0 and still see the same error..
I have insert statement
insert into mytableA
(col1,col2..)
(select col1,col2. from mytableB
)
if SQL%ROWCOUNT = 0 then
v_txt := v_program||': '||': Tables Not Created. Check!!!!;
RAISE_APPLICATION_ERROR(-2
END IF;
that is all the code involved in this error.. let me know..
begin
insert into temp_table select * from testing1 ;
dbms_output.put_line('coun
if SQL%ROWCOUNT = 0 then
dbms_output.put_line('in exception');
RAISE_APPLICATION_ERROR(-2
END IF;
end;
/
output is ( i have oracle express edition 10g ) :
count:3 ---> this shows me the number of records as 3 and no exception is raised
Statement processed.
0.03 secondsDBMS Output
i modified your code to the above because there is no ; after the insert 'insert into mytableA
(col1,col2..)
(select col1,col2. from mytableB
)' and this line i removed because it gave me error saying variable is not defined.
Let me know if you need any other help.
Thanks
I just tried the same and it always worked if it is written as a test procedure with insert statement and sql%rowcount has a value, but inside a package same insert statement when you do sql%rowcount after the commit statement did not work ( meaning it gave zero as value)
not sure how this can be reproduced..
the same code was working fine in 8i not sure why this is not normal for 10g
8i code
insert statement
commit
if sql%rowcount = 0 then
--error statement
end if;
the same code when ported to 10g errored eventhough insert statement worked and the rows inserted to table is greater than zero..
I dont understand how it can work in 8i and not in 10g
the sql%rowcount should be after the insert statement.
you can either put the commit just below the end if of sql%rowcount if condition or as you have done, we can have a variabel and then use that variable.
i am not sure how it worked in 8i code... Ideally it should not and it will not...but i cannot test it because i do not have 8i database with me.
Thanks
Business Accounts
Answer for Membership
by: sujit_kumarPosted on 2007-07-20 at 13:52:26ID: 19535121
have you tried "if SQL%ROWCOUNT <= 0 then"?