Error in Stoerd Procedure But working in Anonymous Block.
declare
Cursor Cur Is
Select 'Alter '||Object_Type||' '||Object_Name||' Compile' Invalid_Obj, Object_Type, Object_Name
From Dba_Objects A
Where A.Owner='Dataload' And A.Status='Invalid' ;
Begin
For I In Cur
Loop
Begin
Execute Immediate I.Invalid_Obj;
Exception
When Others Then
Null;--Dbms_Output.Put_Line(Sqlerrm||' : '||I.Object_Type||' '||I.Object_Name);
End;
End Loop;
Exception
When Others Then
Null;--Dbms_Output.Put_Line(Sqlerrm);
End;
Above anonymous block Run successfully.
but when I create it as stored procedure then, it give error like
Dba_Objects does not exist.
Please, suggest what I do for stored procedure?
Edited by: Nilesh Hole on Jun 2, 2010 12:00 AM
If you don't have any sys rights you either should
a) ask the DBA to run utlrp (preferred, as that always executes compilation in the right order)
b) do not use dba_objects but user_objects, assuming you are connected as DATALOAD
In a normal situation this shouldn't be necessary, so you should still question why you even want to do this (and are reinventing the wheel). Also the dbms_utility package has a COMPILE_SCHEMA procedure.
Sybrand Bakker
Senior Oracle DBA
Similar Messages
-
ACL denied using Pkb but works using anonymous block with same user
I have a recent 11g installation with a developer that is getting a access denied message when using a package but is able to run the same code manually in sqlplus and it works.
eg. I have granted access to connect and resolve to the user BLAH.
from sqlplus, BLAH can do
select trim(substr(utl_inaddr.get_host_name,1,30)) from dual;
TRIM(SUBSTR(UTL_INADDR.GET_HOST_NAME,1,30))
serverhostname
and get the hostname successfully, but this same line in a pkb fails when called like so
exec func_name.something()
BEGIN func_name.something(); END;
ERROR at line 1:
ORA-24247: network access denied by access control list (ACL)
ORA-06512: at "SYS.UTL_INADDR", line 4
ORA-06512: at "SYS.UTL_INADDR", line 35
ORA-06512: at line 1
ORA-06512: at "BLAH.FUNC_NAME", line 83
ORA-06512: at line 1
but if you were to do this same bit of code in sqlplus as follows:
set serveroutput on
declare
mhost varchar(30);
begin
select trim(substr(utl_inaddr.get_host_name,1,30)) into mhost
from dual;
dbms_output.put_line(mhost);
end;
it works.
I do not understand this at all. This is the same user account that owns the pkb and is running it in sqlplus. The user has been granted the connect and resolve priv through being granted a role that has this permission.
Can anyone help me out here?Thanks, the oracle logic behind this doesn't make sense to me - if the user can do this action, then surely the user should be able to run the package...
Anyway, I will try to grant directly to the user that needs the privs, but then how do I grant this privilege to multiple users, it's some awkward bit of pl/sql just to grant it to one user.
Here is what I did:
dbms_network_acl_admin.create_acl(acl => 'filename.xml',
description => 'Network permissions for BLAH_USER to connect/resolve any host',
principal => 'BLAH_USER', is_grant => TRUE, privilege => 'connect');
dbms_network_acl_admin.add_privilege(acl => 'filename.xml', principal => 'BLAH_USER', is_grant => TRUE, privilege => 'resolve');
dbms_network_acl_admin.assign_acl(acl => 'filename.xml', host => '*');
grant execute on dbms_network_acl_admin to BLAH_USER;
but this only works for 1 user and I cannot recreate this as the acl now already exists. Would I have to change filename.xml every time and do all these steps for every user?
This is why I granted to a role and then granted that role to the BLAH_USER originally.
Any ideas on how to make this scalable to many users or to add users to this ACL? -
Cursor query works in anonymous block but not in procedure
Hello,
My cursor query works fine in anonymous blcok but fails in pl/sql block.
Anonymous block:
declare
cursor c1 is
select object_name
from all_objects
where owner='IRIS_DATA'
and object_type='SEQUENCE';
v_string varchar2(2000);
begin
for c2 in c1 loop
v_string := 'DROP SEQUENCE IRIS_DATA.'||c2.object_name;
execute immediate v_string;
end loop;
commit;
exception
when others then
dbms_output.put_line('Exception :'||sqlerrm);
end;
works fine.
but inside the procedure the it doesn't go inside the cursor loop
procedure get_sequence is
l_dp_handle NUMBER;
v_job_state varchar2(4000);
l_last_job_state VARCHAR2(30) := 'UNDEFINED';
l_job_state VARCHAR2(30) := 'UNDEFINED';
l_sts KU$_STATUS;
v_logs ku$_LogEntry;
v_row PLS_INTEGER;
v_string1 varchar2(2000);
cursor seq_obj is
select object_name
from all_objects
where owner='IRIS_DATA'
and object_type='SEQUENCE';
begin
log_status('get_sequence started.');
--Cursor records to drop the sequences before importing.
for seq_obj_rec in seq_obj loop
log_status('get_sequence: Dropping sequence started.');
v_string1 := 'DROP SEQUENCE IRIS_DATA.'||seq_obj_rec.object_name;
execute immediate v_string1;
end loop;
log_status('get_sequence: Dropping sequence completed.');
exception
WHEN OTHERS THEN
log_status('get_sequence: exception.');
end get_sequence;
it's not going into the seq_obj_rec cursor.
I granted select on all_objects to the user.this user is also having the DBA role as well.
Please advice.PROCEDURE Get_sequence
IS
l_dp_handle NUMBER;
v_job_state VARCHAR2(4000);
l_last_job_state VARCHAR2(30) := 'UNDEFINED';
l_job_state VARCHAR2(30) := 'UNDEFINED';
l_sts KU$_STATUS;
v_logs KU$_LOGENTRY;
v_row PLS_INTEGER;
v_string1 VARCHAR2(2000);
CURSOR seq_obj IS
SELECT object_name
FROM all_objects
WHERE owner = 'IRIS_DATA'
AND object_type = 'SEQUENCE';
BEGIN
Log_status('get_sequence started.');
--Cursor records to drop the sequences before importing.
FOR seq_obj_rec IN seq_obj LOOP
Log_status('get_sequence: Dropping sequence started.');
v_string1 := 'DROP SEQUENCE IRIS_DATA.'
||seq_obj_rec.object_name;
EXECUTE IMMEDIATE v_string1;
END LOOP;
Log_status('get_sequence: Dropping sequence completed.');
EXCEPTION
WHEN OTHERS THEN
Log_status('get_sequence: exception.');
END get_sequence; How do I ask a question on the forums?
SQL and PL/SQL FAQ
scroll down to #9 & use tags in the future. -
I have tried a lot searching for such issue, but cd not find any solution which
cd help me.
We have a jsp which compiles well in one enviroment, but does not compile in another.
The enviroment in which it compiles is as follows:
OS: Solaris 2.6, Patch level 32
wls version: 6.1 with no service pak
The enviroment in which it does not compile is as follows:
OS: Solaris 8, Patch level 19
wls version: 6.1 with no service pak
In the second enviroment, it gives the folowing error, when invoked...
//error start....
/requisition/reqteamwiz.jsp(532): scriptlet close brace '}' unbalanced at line
532 which breaks scope '_base_service_scope_'
probably occurred due to an error in /requisition/reqteamwiz.jsp line 532:
<strong><font face="Verdana" size="1"><input type="button" style="font-family:
Verdana; font-size: 8pt" name="B1" value=" Submit " onClick="FrontPage_Form1_Validator(document.FrontPage_Form1,
'<%= i%>')"></td></font></strong>
//error end
The line seems OK, and this works fine in the first enviroment.
Cd anyone pls give any suggestions or references as to any known issues with the
second enviroment.
Thanks a lot...
[email protected] (David M. Karr) wrote:
>>>>>> "vinay" == vinay s <[email protected]> writes:
>
> vinay> I have tried a lot searching for such issue, but cd not find
>any solution which
> vinay> cd help me.
> vinay> We have a jsp which compiles well in one enviroment, but does
>not compile in another.
> vinay> The enviroment in which it compiles is as follows:
> vinay> OS: Solaris 2.6, Patch level 32
> vinay> wls version: 6.1 with no service pak
>
> vinay> The enviroment in which it does not compile is as follows:
> vinay> OS: Solaris 8, Patch level 19
> vinay> wls version: 6.1 with no service pak
>
> vinay> In the second enviroment, it gives the folowing error, when
>invoked...
> vinay> //error start....
> vinay> /requisition/reqteamwiz.jsp(532): scriptlet close brace '}'
>unbalanced at line
> vinay> 532 which breaks scope '_base_service_scope_'
> vinay> probably occurred due to an error in /requisition/reqteamwiz.jsp
>line 532:
> vinay> <strong><font face="Verdana" size="1"><input type="button"
>style="font-family:
> vinay> Verdana; font-size: 8pt" name="B1" value=" Submit " onClick="FrontPage_Form1_Validator(document.FrontPage_Form1,
> vinay> '<%= i%>')"></td></font></strong>
> vinay> //error end
>
> vinay> The line seems OK, and this works fine in the first enviroment.
> vinay> Cd anyone pls give any suggestions or references as to any
>known issues with the
> vinay> second enviroment.
> vinay> Thanks a lot...
>
>If you use an expression scriptlet for an attribute value, it has to
>be the
>entire attribute value, not just a portion of it.
>
>--
>===================================================================
>David M. Karr ; Java/J2EE/XML/Unix/C++
>[email protected] ; SCJP; SCWCD
>
>
I am using the scriplet for entire value, seems the post got jumbled up.
FrontPage_Form1_Validator is a javascript function which takes 2 parameters, one
of which is provided by the expression scriplet.
<strong><font face="Verdana" size="1"><input type="button" style="font-family:
Verdana; font-size: 8pt" name="B1" value=" Submit " onClick="FrontPage_Form1_Validator(document.FrontPage_Form1,
'<%= i%>')"></td></font></strong>
-
PS3 DNS Error with WR54GL wireless but works with BEFVP41 Wired router?
I have the following network set up,
Modem - BEFVP41 Router (all filled up) - a switch (all filled up as well) - WR54GL wireless router (set up as a switch) - PS3.
I have 2 pc's connected to the BEFVP41, one pc connected to WR54GL and 3 laptops via wi fi working off the WR54GL as well.
Everything works fine with the exception of PS3. It is able to obtain the IP address but returns a DNS error when testing the internet connection.
When I wire the PS3 directly to the BEFVP41 router it works flawlessly. But if I try to set up to work via the wireless WR54GL it fails every time and returns the DNS error.
I have the latest firmare for both routers as well as the PS3.
This leads me to believe there is an issue between the PS3 and the wireless router or some sort of networking issue between the wireless router and the main router. Im not a network buff, matter of fact i know very little about this so i really dont know where and what settings to adjust or even where to begin the trouble shooting.
Any suggestions? Do I need to do port forwarding or whatever or adjust some dns settings in the wireless router? Any guidance is appreciated.
Message Edited by Tinted on 12-16-2008 01:08 AMFirst you can login to your wired Router (BEFVP41) and find out the DNS adress on Status Tab.
Then you can manully set Static Ip to your PS3 in the range of Router and Give Static DNS and Test the Connections. -
I'm in the process of trying to convert an existing gen1 VM (Win Server 2012 R2) to a VM template using VMM 2012 R2 with rollup 1. The creation keeps failing with the following error :-
"Error
(2901)The operation did not complete successfully because of a parameter or call sequence
that is not valid.Recommended ActionEnsure
that the parameters are valid, and then try the operation again."
I've checked that the local administrator account for the machine being converted to a template and it is blank as expected and in an attempt to troubleshoot I've output the template creation script via the VMM GUI and executed the commands in order which appears
to have resolved the problem, well the template finishes creation, i'm yet to deploy a machine via it?
# Create VM Template Wizard Script
# Script generated on Thursday, April 3, 2014 12:52:15 PM by Virtual Machine Manager
# For additional help on cmdlet usage, type get-help <cmdlet name>
$VM = Get-SCVirtualMachine -VMMServer localhost -Name "MyTemplate_Template" -ID "98299447-83e1-4d98-a558-a96ebafcf9b5"
| where {$_.VMHost.Name -eq "myhost.mydomain.com"}
$LibraryServer = Get-SCLibraryServer -VMMServer localhost | where {$_.Name -eq "my.library.com"}
$GuestOSProfile = Get-SCGuestOSProfile -VMMServer localhost | where {$_.Name -eq "Windows Server 2012
R2"}
$OperatingSystem = Get-SCOperatingSystem -VMMServer localhost -ID "50b66974-c64a-4a06-b05a-7e6610c579a2"
| where {$_.Name -eq "Windows Server 2012 R2 Standard"}
$template = New-SCVMTemplate -Name "My Template" -RunAsynchronously -VM $VM -LibraryServer $LibraryServer
-SharePath "\\mylibrary.mydomain.com\SCVMM Library\Templates\mytemplatedestination" -GuestOSProfile $GuestOSProfile -JobGroup d2f2f539-85da-4091-ab08-abe739fc4761 -ComputerName "*" -TimeZone 85 -FullName "Administrator"
-OrganizationName "My Organisation" -Workgroup "WORKGROUP" -AnswerFile $null -OperatingSystem $OperatingSystem
Now the only fields that weren't populated when I ran through the gui were FullName and Organization? Before I changed the script these two fields were just set to ""? Is that what has potentially caused the issue are they both required fields?Your not the only one who can reproduce this. Did you ever find out what it was? I saw your post and tried your same work-around and it also worked for me via Powershell.
-
Error on jsp page (but works great on my desktop)
Hi guys,
Here is a weird thing that happened (it's always weird :-) ).
I built a simple application j2ee) which runs perfectly on my desktop. When I copied the webapp folder (Test) under the tomcat/webapps folder to my laptop (same directory) I get the error message below.
I have the same tomcat and same configuration.
Any idea???
Thanks for any help
Xian
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: -1 in the jsp file: null
Generated servlet error:
[javac] Since fork is true, ignoring compiler setting.
[javac] Compiling 1 source file
[javac] Since fork is true, ignoring compiler setting.
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:120)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:307)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:410)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:450)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:434)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:571)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:288)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:294)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:490)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1020)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:196)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:490)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1020)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2625)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:490)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1020)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:490)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1020)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:196)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:612)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:430)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:623)
at java.lang.Thread.run(Unknown Source)
Apache Tomcat/5.0.1JSP page:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@page import="java.util.*,model.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>View Info</title>
</head>
<body>
<center>
<%
UpdateAndGet li = new UpdateAndGet();
ArrayList list = (ArrayList)li.getAll();
%>
<table cellSpacing=1 cellPadding=3 border=1 width="100%">
<tr>
<th>ID</th>
<th>Name</th>
<th>Sex</th>
<th>Testcode</th>
<th>Email</th>
<th>Cellphone</th>
<th>Give Grade</th>
</tr>
<%
Student stu = null;
Iterator it = list.iterator();
while (it.hasNext()) {
stu = (Student) it.next();
session.setAttribute(String.valueOf(stu.getId()), stu);
%>
<tr>
<td><%=stu.getId()%></td>
<td><%=stu.getName()%></td>
<td><%=stu.getSex()%></td>
<td><%=stu.getTestcode()%></td>
<td><%=stu.getEmail()%></td>
<td><%=stu.getCellphone()%></td>
<td><a href="update.do?id=<%=stu.getId()%>">Give Grade</a></td>
</tr>
<%
%>
</table>
<p><font color=blue>There are<%=list.size()%> examinees</font>
</center>
</body>
</html> -
Cursor Not working stored Procedure but it working in anonymous Procedure
Hi Gurus....
My problem looks different.....my code was working as anonymous block where as it was not working as stored Procedure
Declare
cursor c_tblspace is
select fs.tablespace_name TBL_SPC_NAME
, round((100 *((sum(fs.bytes)) / df.bytes)), 2) PCT_Free
from sys.dba_data_files df
, sys.dba_free_space fs
,partition_tables ms
where df.file_id(+) = fs.file_id
and fs.tablespace_name =ms.tbspc_nam
group by fs.file_id, df.bytes, fs.tablespace_name;
begin
for rec_tblspace in c_tblspace
loop
if ( rec_tblspace.PCT_Free > 5 )
then
insert into t_space (tbspc_nm,ftr_spc)
values(rec_tblspace.TBL_SPC_NAME,'full');
dbms_output.put_line(rec_tblspace.TBL_SPC_NAME||' is full');
end if;
end loop;
end;where as it working while i want to create a stored Procedure...
create or replace procedure p_upd_space is
cursor c_tblspace is
select fs.tablespace_name TBL_SPC_NAME
, round((100 *((sum(fs.bytes)) / df.bytes)), 2) PCT_Free
from sys.dba_data_files df
, sys.dba_free_space fs
,partition_tables ms
where df.file_id(+) = fs.file_id
and fs.tablespace_name =ms.tbspc_nam
group by fs.file_id, df.bytes, fs.tablespace_name;
begin
for rec_tblspace in c_tblspace
loop
if ( rec_tblspace.PCT_Free > 5 )
then
insert into t_space (tbspc_nm,ftr_spc)
values(rec_tblspace.TBL_SPC_NAME,'full');
dbms_output.put_line(rec_tblspace.TBL_SPC_NAME||' is full');
end if;
end loop;
end;It was throwing following error...
PL/SQL: ORA-00942: table or view does not existJustin is right. You are creating definer right stored procedure.
Roles are disabled during definer rights stored procedure compilation and execution.
Here is the test case:
#1. Anonymous Procedure
HRDEMO@fmw//scripts> conn / as sysdba
SYS@fmw//scripts> create user todd identified by oracle;
SYS@fmw//scripts> grant dba to todd; --DBA role granted
SYS@fmw//scripts> conn todd/oracle
TODD@fmw//scripts> declare
2 cursor c is select * from dba_data_files;
3 begin
4 null;
5 end;
6 /
PL/SQL procedure successfully completed.
#2. Stored Procedure
TODD@fmw//scripts> create or replace procedure p1
2 is
3 cursor c is select * from dba_data_files;
4 begin
5 null;
6 end;
7 /
Warning: Procedure created with compilation errors.
TODD@fmw//scripts> show error
3/27
PL/SQL: ORA-00942: table or view does not exist -
ORA-06550 error while executing procedure
HI Friends,
I have written a proc for the below process.
SP_Control (table)
sno campgn_id campgn_typ campgn_no current_wave
1 ET07001 ONB ONB01 1
2 ET07001 ONB CNB01 1
3 ET03053 IAL IAL1A A
4 ET03053 IAL IAL2A A
5 ET03053 IAL IAL3A A
6 ET03053 IAL IAL4A A
After calling the procedures with bellow parameters
Get_next_campgn(‘ONB01’,’ONB’);
Get_next_campgn(‘CNB01’,’ONB’);
Get_next_campgn(‘IAL1A’,’IAL’);
Get_next_campgn(‘IAL2A’,’IAL’);
Get_next_campgn(‘IAL3A’,’IAL’);
Get_next_campgn(‘IAL4A’,’IAL’);
…………… it should update the table with below data.
sno campgn_id campgn_typ campgn_no current_wave
1 ET07001 ONB ONB02 2
2 ET07001 ONB CNB02 2
3 ET03053 IAL IAL1B B
4 ET03053 IAL IAL2B B
5 ET03053 IAL IAL3B B
6 ET03053 IAL IAL4B B
I have written a procedure like this and its compliled successfully.
But throws error while executing like
execute Get_next_campgn(‘ONB01’,’ONB’);
create or replace procedure Get_next_campgn(p_campgn varchar2,p_type varchar2)
as
begin
update SP_Control set campgn_no = substr(p_campgn,1,length(p_campgn)-1)||to_char(ascii(substr(p_campgn,-1,1))+1) ,
curr_wave = to_char(ascii(curr_wave)+1)
where campgn_type = p_type
and campgn_no = p_campgn ;
exception
when others then
dbms_output.put_line(sqlerrm);
end Get_next_campgn;
Error::::
Error starting at line 15 in command:
execute Get_next_campgn(‘ONB01’,’ONB’)
Error report:
ORA-06550: line 1, column 24:
PLS-00103: Encountered the symbol "" when expecting one of the following:
( ) - + case mod new not null <an identifier>
<a double-quoted delimited-identifier> <a bind variable>
table continue avg count current exists max min prior sql
stddev sum variance execute multiset the both leading
trailing forall merge year month day hour minute second
timezone_hour timezone_minute timezone_region timezone_abbr
time timestamp interval date
<a string literal with character set specification>
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
Please suggest....The procedure executed successfully for me.
drop table sp_control;
create table sp_control
campgn_no varchar2(20),
curr_wave varchar2(20),
campgn_type varchar2(20)
insert into sp_control values ('ONB01', '1', 'ONB');
insert into sp_control values ('IAL1A', 'A', 'IAL');
create or replace procedure Get_next_campgn(p_campgn varchar2,p_type varchar2)
as
begin
update SP_Control set campgn_no = substr(p_campgn,1,length(p_campgn)-1)||to_char(ascii(substr(p_campgn,-1,1))+1) ,
curr_wave = to_char(ascii(curr_wave)+1)
where campgn_type = p_type
and campgn_no = p_campgn ;
exception
when others then
dbms_output.put_line(sqlerrm);
end Get_next_campgn;
begin
Get_next_campgn('ONB01','ONB');
end;
select * from sp_control;
--Output as Follows:
drop table sp_control succeeded.
create table succeeded.
1 rows inserted
1 rows inserted
procedure Get_next_campgn(p_campgn Compiled.
anonymous block completed
CAMPGN_NO CURR_WAVE CAMPGN_TYPE
ONB050 50 ONB
IAL1A A IAL
2 rows selectedJust a hunch, in the Procedure call
execute Get_next_campgn(‘ONB01’,’ONB’);the "Single Quotes" does not appear correct. They were probably typed into some other editor.
When executed as
execute Get_next_campgn(‘ONB01’,’ONB’);
Error starting at line 1 in command:
begin
Get_next_campgn(‘ONB01’,’ONB’);
end;
Error report:
ORA-06550: line 2, column 19:
PLS-00103: Encountered the symbol "‘" when expecting one of the following:
( ) - + case mod new not null <an identifier>
<a double-quoted delimited-identifier> <a bind variable>
table continue avg count current exists max min prior sql
stddev sum variance execute multiset the both leading
trailing forall merge year month day hour minute second
timezone_hour timezone_minute timezone_region timezone_abbr
time timestamp interval date
<a string literal with character set specification>
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:So, just replace them in any SQL editor and your Invoker block shall work properly.
Regards,
P. -
Error with stored procedure block datasource
Hi all,
I tried to base a datablock on a stored procedure in order to get better runtime performance. I work with Forms Builder 6i with patch 17 , and our database is oracle 8.1.7.1.4
But when compiling I got errors.
Here are what I did :
create or replace type TSourceObject as object(name varchar2(30), propname varchar2(200));
create or replace type TSourceTable is table of TSourceObject;
create or replace procedure p_query_ntwk_chnl_mirror(p_tab IN OUT NOCOPY TSourceTable, p_action varchar2, p_lien number)
is
begin
if p_action = 'VISU' then
select TSourceObject(B.bdw_name, P.prop_bdw_name)
bulk collect into p_tab
from T_NETWORK_CHANNEL N, t_bdw_mw B, t_prop_bdw_mw P
where B.comp_bdw = P.comp_bdw and P.comp_prop_bdw = N.comp_prop_bdw
and EXISTS (SELECT 1
FROM t_channel_element C
WHERE N.comp_network_channel = C.comp_network_channel and comp_lien = p_lien);
else
select TSourceObject(B.bdw_name, P.prop_bdw_name)
bulk collect into p_tab
from T_NETWORK_CHANNEL N, t_bdw_mw B, t_prop_bdw_mw P
where B.comp_bdw = P.comp_bdw and P.comp_prop_bdw = N.comp_prop_bdw;
end if;
end;
Then I created the datablock with the wizard , I entered correctly the value of the arguments for the table type name, the argument p_action and the argument p_lien.
And when compiling there was this alert error :
Compiling QUERY-PROCEDURE trigger on NETWORK_CHANNEL_MIRROR data block...
Compilation error on QUERY-PROCEDURE trigger on NETWORK_CHANNEL_MIRROR data block:
PL/SQL ERROR 960 at line 5, column 9
RPCs cannot use variables with schema level user-defined types in this release
PL/SQL ERROR 0 at line 5, column 9
Item ignored
PL/SQL ERROR 320 at line 7, column 26
the declaration of the type of this expression is incomplete or malformed
PL/SQL ERROR 0 at line 7, column 1
Statement ignored
PL/SQL ERROR 320 at line 8, column 28
the declaration of the type of this expression is incomplete or malformed
PL/SQL ERROR 0 at line 8, column 1
Statement ignored
Compilation errors have occurred.
So what should I do ?
Thank you very much indeed.I create the package , and when creating the body then there was an error.
Here is the package :
create or replace package pkg_query_ntwrk_chnl_mirror
is
type TSourceObject is record(name varchar2(30), propname varchar2(200));
type TSourceTable is table of TSourceObject index by binary_integer;
procedure p_query_ntwk_chnl_mirror(p_tab IN OUT NOCOPY pkg_query_ntwrk_chnl_mirror.TSourceTable, p_action varchar2, p_lien number);
end;
create or replace package body pkg_query_ntwrk_chnl_mirror
is
procedure p_query_ntwk_chnl_mirror(p_tab IN OUT NOCOPY pkg_query_ntwrk_chnl_mirror.TSourceTable, p_action varchar2, p_lien number)
is
begin
if p_action = 'VISU' then
select B.bdw_name, P.prop_bdw_name
bulk collect into p_tab
from T_NETWORK_CHANNEL N, t_bdw_mw B, t_prop_bdw_mw P
where B.comp_bdw = P.comp_bdw and P.comp_prop_bdw = N.comp_prop_bdw
and EXISTS (SELECT 1
FROM t_channel_element C
WHERE N.comp_network_channel = C.comp_network_channel and comp_lien = p_lien);
else
select B.bdw_name, P.prop_bdw_name
bulk collect into p_tab
from T_NETWORK_CHANNEL N, t_bdw_mw B, t_prop_bdw_mw P
where B.comp_bdw = P.comp_bdw and P.comp_prop_bdw = N.comp_prop_bdw;
end if;
end;
end;
And here is the error :
7/2 PL/SQL: SQL Statement ignored
8/20 PLS-00597: expression 'P_TAB' in the INTO list is of wrong type
15/2 PL/SQL: SQL Statement ignored
16/20 PLS-00597: expression 'P_TAB' in the INTO list is of wrong type
And what is the problem here ? I think it is right! -
Why WHO_CALLED_ME return me ANONYMOUS BLOCK ?
I would like to know the name of the current of stored procedure with the name of the package.
So I use OWA_UTIL.WHO_CALLED_ME function but it returns ANONYMOUS BLOCK and not "PROCEDURE" and the name of my procedure.
Do you know why ?
Example :
create or replace
PACKAGE BODY RDF_UTILS AS
PROCEDURE T1
IS
owner varchar2(30);
nom varchar2(200);
lineno number;
caller_t varchar2(200);
BEGIN
sys.DBMS_OUTPUT.PUT_LINE (sys.DBMS_UTILITY.FORMAT_CALL_STACK);
sys.DBMS_OUTPUT.NEW_LINE();
sys.DBMS_OUTPUT.NEW_LINE();
sys.OWA_UTIL.WHO_CALLED_ME(owner, nom, lineno, caller_t);
sys.DBMS_OUTPUT.PUT_LINE('owner ='||owner||'name = '||nom||'lineno = '||lineno||'caller_t = '||caller_t);
END;
END RDF_UTILS;Because that's the way it works.I thought we were all making a concerted effort not to post sarcastic one-liners.
@sed: The who_called_me function is intended to return the user who called your function / procedure, not the immediate caller of the 'who_called_me' function.
Perhaps Tom Kyte's original post will be of help (compare with the who_am_i function).
http://asktom.oracle.com/tkyte/who_called_me/
http://asktom.oracle.com/tkyte/who_called_me/who.sql -
Ref cursor from anonymous block
I have no problem to get a ref cursor from a Fill method call with an anonymous pl/sql block. But if my anonymous block contains a DECLARE section, the dataset is not populated.
ex:
BEGIN OPEN :cuInscription FOR SELECT column FROM table; END;
is ok but with
DECLARE A NUMBER; BEGIN OPEN :cuInscription FOR SELECT column FROM table; END;
the dataset is not populated (even if the SQL CALL succeed).
Do you know about that?This issue has been fixed in the ODP.NET 92040 release.
-
Error while accessing table from procedure but no error from anonymous plsq
Hi All,
I am getting a strange error while accessing a table from a different schema.
In that concerned schema OWBSYS, i executed the following:
grant Select on wb_rt_audit to ods;In Ods schema i executed:
CREATE OR REPLACE SYNONYM wb_rt_audit FOR OWBSYS.wb_rt_audit;In ODS schema, when i execute:
create or replace
procedure pp_test as
lv_owb_reject number := 0;
lv_filename_1 varchar2(200):= 'asda';
begin
SELECT MAX(aud.rta_iid) into lv_owb_reject
FROM wb_rt_audit aud
WHERE aud.rta_lob_name LIKE Upper(lv_filename_1)
end;
/I get the error:
Warning: execution completed with warning
procedure Compiled.
ORA-00942 - TABLE OR VIEW DOES NOT EXISTHowever, when i execute as an anonymous plsql the same code:
declare
lv_owb_reject number := 0;
lv_filename_1 varchar2(200):= 'asda';
begin
SELECT MAX(aud.rta_iid) lv_owb_reject
FROM wb_rt_audit aud
WHERE aud.rta_lob_name LIKE Upper(lv_filename_1)
end;
anonymous block completedthere is no issue.
Can someone help me understand what I might be missing:
Edited by: Chaitanya on Feb 28, 2012 12:31 AMCheck if have some other steps.
SQL>conn scott1/tiger
Connected.
SQL>create table wb_rt_audit (rta_iid number);
Table created.
SQL>insert into wb_rt_audit values (100);
1 row created.
SQL>insert into wb_rt_audit values (200);
1 row created.
SQL>commit;
Commit complete.
SQL>grant select on wb_rt_audit to scott2;
Grant succeeded.
SQL>conn scott2/tiger
Connected.
SQL>create synonym wb_rt_audit for scott1.wb_rt_audit;
Synonym created.
SQL>create or replace procedure pp_test as
l_number number(10);
begin
SELECT MAX(rta_iid) into l_number
FROM wb_rt_audit;
end pp_test;
Procedure created. -
Can select resource content in anonymous block, but not in stored procedure
I know the problem relates to the ACLs but am curious about the following behaviour:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
running on Windows XP sp2
Trying to access an existing resource '/home/test/test.dtd'
/home is owned by SYS
/home/test is owned by me
/home/test.test.dtd is owned by me
The following SQL and anonymous block retrieve the content of the resource:
select extract(p.res,'/*').getClobVal()
from resource_view p
where p.any_path = '/home/test/test.dtd'
declare
alldata clob;
begin
select extract(p.res,'/*').getClobVal()
into alldata
from resource_view p
where p.any_path = '/home/test/test.dtd'
dbms_output.put_line(substr(alldata, 1, 255));
end;
BUT when I encapsulate the anonymous block in a stored procedure, I am told that the folder '/home/test/' does not exist.
As said, the problem related to the ACL on the folders, what I cannot understand, and caused me considerable confusion, is why I was unable to get the content from a stored procedure when I was able to do so from an anonymous block.
regards
RichardUse equals_path(res,'/home/test/test.dtd') = 1OK, OK, but how do you use wildcards (if you want to) since any_path like '/home/test%' works?
Who was the stored procedure owned by. Was it a stand-alone stored procedure or a
method on a package. If it was a method on a package is it AUTHID creator or AUTHID
definer.Everything apart from the '/home' folder is owned by the current user.
The PL/SQL was in a packaged procedure, a stand-alone stored procedure, and an anonymous block. It exhibited the same behaviour in each. All were defined with default AUTHID which is definers rights which is the same as the current user in this case. -
Error in MB1C but works perfectly in MIGO for movement type 501.
Hi
I get an error in MB1C but works perfectly in MIGO for movement type 501
here is the error Account 353300 requires an assignment to a CO object.
I know for this if we add the co object in OKB9 it works.
But my question is - how it works in MIGO transaction but throws an error in MB1C
Any idea ? has any one faced this kind of an issue ? Please let me know.
Thanks
DkmurthyHi
Are the entires same in both the transactions? Means did you check 353300 GL was hit when you posted through MIGO?
Check in FS00 - for GL account 353300 - under bank/interest tab - double click on field status variant -> under Additional account assignments - CO object is ticked as mandatory?
Thanks
Maybe you are looking for
-
Hi there everyone. Recently my laptop was not functioning well, the Windows Store are not responsive also all the Windows Apps, not to mention my Microsoft Office was faulty here and there. I tried the Refresh function, but it didn't work, so I went
-
I want to move notes from my iphone 5s to icloud
I cannot push notes from my iphone 5s to my icloud account. Is there any way to do this or does it only work the other way round? Also my notes seems to have separate accounts for the phone, icloud and a bunch of my email addresses (with no notes on
-
High swap file utilization - 11g on windows 2003 x64
Hi, I'm running database 11.1.0.6 patch set 10 on Windows Server 2003 x64 standard HP DL380 dual quad core + 8GB RAM 2 x 72GB 15K SAS mirror for OS 6 x 72GB 15k SAS RAID-5 for data + logs (i know ideally logs need to move to a RAID-1 set etc) dedicat
-
How to make SSL supporting configuration
Dear Friends, I got the following exception once when my connection routes through SSL, ie., https Kindly convey do i need any specific configuration needed to support SSL. java.lang.ExceptionInInitializerError at java.lang.Class.forName0(Native
-
OT: How can we tune the search performance from the HTMLDB side?
This might be not an issue that can be solved by HTMLDB itself. However, I'd like to give a shot because our HTMLDB apps are 'killing' the server, according to our DBA. One app I made is querying a 50 million records table, so everytime the query is