Raise statement in a package.
I am just curious about the raise statement used in plsql.
exception
when others then
dbms_application_info.set_module('', '');
dbms_application_info.set_client_info('');
x_err_code := sqlcode;
x_err_message := sqlerrm;
log_message(p_message => x_err_message,
p_proc_name => lc_proc_name,
p_event_status => constants_pkg.event_error);
log_message('excpt5', lc_proc_name);
raise; ------------------------------------------------------------------------------------------------------------what does it do?it is not associated with any exception.
end apply_payment_by_vtxn;
Whatever caused the code to enter the exception block will be re-raised, it does not matter what it was that caused it, or where in the code it came from. Consider:
SQL> create procedure p (p_num in number, p_str in varchar2) as
2 l_v varchar2 (2);
3 begin
4 if p_num is not null then
5 select dummy into l_v
6 from dual
7 where 1 = p_num;
8 else
9 select p_str into l_v
10 from dual;
11 end if;
12 exception
13 when others then
14 raise;
15 end;
16 /
Procedure created.
SQL> exec p(2, null);
BEGIN p(2, null); END;
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at "OPS$ORACLE.P", line 14
ORA-06512: at line 1
SQL> exec p(null, 'Hello');
BEGIN p(null, 'Hello'); END;
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "OPS$ORACLE.P", line 14
ORA-06512: at line 1Note that the line number for the error is at the raise, not where the original error occurred.
John
Similar Messages
-
The use of a stand alone RAISE statement
What is the point of having a standalone RAISE statment (ie a RAISE statement without arguments).
BEGIN
DECLARE
e_UserDefinedException EXCEPTION;
BEGIN
RAISE e_UserDefinedException;
END;
EXCEPTION
WHEN OTHERS THEN
/* Just re-raise the exception, which will be propagated to the
calling environment */
RAISE; --the standalone RAISE statement
END;
/When i create a package with several functions and procedures inside I always create a caller procedure called callProcs, which will execute various procedures in the appropriate order.
procedure callProcs(p_ship_type in varchar2)
is
--execute proc1
procedure1();
--execute proc2.
procedure2();
--execute proc3.
procedure3();
--execute proc4.
procedure4();
--commit the transaction.
commit;
exception
when others then
err_msg:=SQLERRM;
--dbms_output.put_line (err_msg);
dbms_output.put_line('Rolling Back');
rollback;
end package_name;
/proc1,proc2 and proc3 has Exception handling like the following
exception
when others
THEN
error_message :='My custom message for the particular proc '||SQLERRM;
dbms_output.put_line(error_message);
logerror(error_message); --an autonomous error logging proc
end;According to the documentation, i should include a standalone RAISE statement like below so that the error is propogated out to calling environment ie.callProcs procedure. But this RAISE statement is not necessary. Right?
exception
when others
THEN
error_message :='My custom message for the particular proc '||SQLERRM;
dbms_output.put_line(error_message);
logerror(error_message); --an autonomous error logging proc
RAISE;
end;The RAISE is used inside the exception handler_.
If you "handle" the error and are satisfied that it has been handled then there is no need to RAISE it back up to the calling code.
If you are just capturing the error i.e. to log it, but you aren't handling it then you should RAISE it back up to the calling code. Somewhere up the chain of calls the error should get handled or, if not, it will exit out of the top of the code and the error will be given to the program that called the code e.g. SQL*Plus etc. which can choose what it does with the error (usually displaying it to the user).
PL/SQL 101 : Exception Handling
PL/SQL 101 : Exception Handling -
Tcode VF02 RAISE statement in the program "SAPLCSS3" raised the exception.
Hi,
I am getting a short dump in my smartform attached with vf02. For few of invoice no. its working perfectly but giving dump in few invoice no.
Below is short dump statement. Pls guide me for this issue.
A RAISE statement in the program "SAPLCSS3" raised the exception
condition "CALL_INVALID".
Since the exception was not intercepted by a superior
program, processing was terminated.
Short description of exception condition:
invalid call
Regards,
Ranu`
Edited by: ranu sharma on Feb 6, 2010 2:55 PMHi Dipesh,
In background SAP GUI functionalities are not available.
This question has been asked many times on scn:
CNTL_ERROR
CNTL_ERROR while running a report in background mode
Regards,
Ashvin -
RAISE statement is behaving inconsistently in my FM!
Hello,
I wrote my FM as below w/ some EXCEPTIONS,
* 1st Block
From 1 to 10 line of code
RAISE exception_1. " Invalid_inco_terms.
* 2nd Block
From 11 to 20 line of code
RAISE exception_2. " Invalid_payment_method
* 3rd Block
From 21 to 30 line of code
RAISE exception_3. " Invalid_partner
* 4th Block
From 31 to 40 line of code
RAISE exception_4. " Invalid_customer_group
* 5th Block
From 41 to 50 line of code
We are calling this FM from workflow as a background step, hence we don't have much chance to check its behaviour / debugging
We noticed its behaving not consistently!
1) In first case: When this FM is executed, when the control comes to the 3rd block, validation failed and EXCEPTION_3 got triggred, but still 4th block piece of code and 5th block piece of code got triggered
2) In 2nd case: When this FM is executed, when the control comes to the 1st block, validation failed and EXCEPTION_1 got triggered, immediately control extted, I mean, the any one of the below blocks are not excuted
Pls. let us know why this inconsistency is?
Pls. let us know ideally how RAISE statement behaves in any FM? Actually, I did F1 and I red the SAP Help but didn't understood it
Thank youHi,
I think there must be something wrong in your code lines for block 3.
Have you debugged it ? Can you please post it here ?
Regards,
Klaus -
Can statements inside a package refer to database links
Hi all
I was just curious to know, what will happen in this case
CREATE OR REPLACE PACKAGE BODY "TESTUSER"."TESTPKG" as
procedure testproc is
n number := 0;
begin
select count(*) into n from ps_tab@dblink;
end;
end testpkg;';
Is it valid to have dblink inside a package body?
Regards
Edited by: user13332773 on Mar 6, 2011 10:26 PMuser13332773 wrote:
Hi all
I was just curious to know, what will happen in this case
CREATE OR REPLACE PACKAGE BODY "TESTUSER"."TESTPKG" as
procedure testproc is
n number := 0;
begin
select count(*) into n from ps_tab@dblnk;
end;
end testpkg;';
Is it valid to have dblink inside a package body?
RegardsSure it is. You can have a database link inside a package code. Moreover, you'll get the name of that database link in the REFERENCED_LINK_NAME column of the DBA_DEPENDENCIES view
Kamran Agayev A.
Oracle ACE
My Oracle Video Tutorials - http://kamranagayev.wordpress.com/oracle-video-tutorials/ -
Package procedure in invalid state
Hi all,
We are having an application in C# and backend oracle 10g placed in Location1.
There is modification in Packaged procedure. So we remotely (from Location2) connected to Location1 and that Packaged procedure is created.
This Packaged procedure has been created (in Location1 ) without any errors. But this procedure is in INVALID state. We tried to compile it remotely by using following statements, but still this is in invalid state .
ALTER PACKAGE my_package COMPILE;
ALTER PACKAGE my_package COMPILE BODY;
If we run this package and package body manually, without any modifications after creating it remotly, it is becoming VALID state.
I am not getting any idea, why it is creating in INVALID state. Any help is appreciated.
Thanks in advance,
PalOk, here's a previous response that I gave re. packages and their "states". Should give you a good idea what a state is...
Packages tend to fail because of their "package state". A package has a "state" when it contains package level variables/constants etc. and the package is called. Upon first calling the package, the "state" is created in memory to hold the values of those variables etc. If an object that the package depends upon e.g. a table is altered in some way e.g. dropped and recreated, then because of the database dependencies, the package takes on an INVALID status. When you next make a call to the package, Oracle looks at the status and sees that it is invalid, then determines that the package has a "state". Because something has altered that the package depended upon, the state is taken as being out of date and is discarded, thus causing the "Package state has been discarded" error message.
If a package does not have package level variables etc. i.e. the "state" then, taking the same example above, the package takes on an INVALID status, but when you next make a call to the package, Oracle sees it as Invalid, but knows that there is no "state" attached to it, and so is able to recompile the package automatically and then carry on execution without causing any error messages. The only exception here is if the thing that the package was dependant on has changes in such a way that the package cannot compile, in which case you'll get an Invalid package type of error.
And if you want to know how to prevent discarded package states....
Move all constants and variables into a stand-alone package spec and reference those from your initial package. Thus when the status of your original package is invlidated for whatever reason, it has no package state and can be recompiled automatically, however the package containing the vars/const will not become invalidated as it has no dependencies, so the state that is in memory for that package will remain and can continue to be used.
As for having package level cursors, you'll need to make these local to the procedures/functions using them as you won't be able to reference cursors across packages like that (not sure about using REF CURSORS though.... there's one for me to investigate!)
This first example shows the package state being invalided by the addition of a new column on the table, and causing it to give a "Package state discarded" error...
SQL> set serveroutput on
SQL>
SQL> create table dependonme (x number)
2 /
Table created.
SQL>
SQL> insert into dependonme values (5)
2 /
1 row created.
SQL>
SQL> create or replace package mypkg is
2 procedure myproc;
3 end mypkg;
4 /
Package created.
SQL>
SQL> create or replace package body mypkg is
2 v_statevar number := 5; -- this means my package has a state
3
4 procedure myproc is
5 myval number;
6 begin
7 select x
8 into myval
9 from dependonme;
10
11 myval := myval * v_statevar;
12 DBMS_OUTPUT.PUT_LINE('My Result is: '||myval);
13 end;
14 end mypkg;
15 /
Package body created.
SQL>
SQL> exec mypkg.myproc
My Result is: 25
PL/SQL procedure successfully completed.
SQL>
SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
2 /
OBJECT_NAME
OBJECT_TYPE STATUS
MYPKG
PACKAGE VALID
MYPKG
PACKAGE BODY VALID
SQL>
SQL>
SQL> alter table dependonme add (y number)
2 /
Table altered.
SQL>
SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
2 /
OBJECT_NAME
OBJECT_TYPE STATUS
MYPKG
PACKAGE VALID
MYPKG
PACKAGE BODY INVALID
SQL>
SQL> exec mypkg.myproc
BEGIN mypkg.myproc; END;
ERROR at line 1:
ORA-04068: existing state of packages has been discarded
ORA-04061: existing state of package body "CRISP_INTELL.MYPKG" has been invalidated
ORA-06508: PL/SQL: could not find program unit being called: "CRISP_INTELL.MYPKG"
ORA-06512: at line 1
SQL>
SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
2 /
OBJECT_NAME
OBJECT_TYPE STATUS
MYPKG
PACKAGE VALID
MYPKG
PACKAGE BODY INVALID
SQL>
SQL> exec mypkg.myproc
PL/SQL procedure successfully completed.
SQL>
SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
2 /
OBJECT_NAME
OBJECT_TYPE STATUS
MYPKG
PACKAGE VALID
MYPKG
PACKAGE BODY VALIDAnd this next example shows how having the package variables in their own package spec, allows the package to automatically recompile when it is called even though it became invalidated by the action of adding a column to the table.
SQL> drop table dependonme
2 /
Table dropped.
SQL>
SQL> drop package mypkg
2 /
Package dropped.
SQL>
SQL> set serveroutput on
SQL>
SQL> create table dependonme (x number)
2 /
Table created.
SQL>
SQL> insert into dependonme values (5)
2 /
1 row created.
SQL>
SQL> create or replace package mypkg is
2 procedure myproc;
3 end mypkg;
4 /
Package created.
SQL>
SQL> create or replace package mypkg_state is
2 v_statevar number := 5; -- package state in seperate package spec
3 end mypkg_state;
4 /
Package created.
SQL>
SQL> create or replace package body mypkg is
2 -- this package has no state area
3
4 procedure myproc is
5 myval number;
6 begin
7 select x
8 into myval
9 from dependonme;
10
11 myval := myval * mypkg_state.v_statevar; -- note: references the mypkg_state package
12 DBMS_OUTPUT.PUT_LINE('My Result is: '||myval);
13 end;
14 end mypkg;
15 /
Package body created.
SQL>
SQL> exec mypkg.myproc
My Result is: 25
PL/SQL procedure successfully completed.
SQL>
SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
2 /
OBJECT_NAME
OBJECT_TYPE STATUS
MYPKG
PACKAGE VALID
MYPKG
PACKAGE BODY VALID
SQL>
SQL> alter table dependonme add (y number)
2 /
Table altered.
SQL>
SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
2 /
OBJECT_NAME
OBJECT_TYPE STATUS
MYPKG
PACKAGE VALID
MYPKG
PACKAGE BODY INVALID
SQL>
SQL> exec mypkg.myproc
My Result is: 25
PL/SQL procedure successfully completed. -
Unable to add java files with package statement
Hi all,
I have the following problem. I add to my project(JBuilder8) a set of java files that
they have in their headers the statement...
package jp.gr.java_conf.tame.swing.table;except one with statement...
package jp.gr.java_conf.tame.swing.colorchooser;If i try to compile the project i get the following message many times for
each file...
"AttributiveCellRenderer.java": Error #: 901 : package
jp.gr.java_conf.tame.swing.table stated in source
C:\Development\JBProjects\cellspan\AttributiveCellRenderer.java does not
match directory . at line 4, column 36What i have to do to embed correctly the java files?
Thank you for advance, kostas.Sounds like your source file is in the wrong directory. The directory the file's in has to match the package.
-
How can i get the error message from the thrown/raised exception?
DB version:10gR2
Examples for this thread taken from
Want Stored Procs to get exectuted regardless of preceeding SPs Success or
I have a package with several functions and procedures inside.I created a caller procedure called callProcs, which will execute various procedures within the package in the appropriate order.
In the below example i cannot get the error message thrown from line 20
create or replace package body mypackage
is
variable_proc1 number;
variable_proc2 number;
variable_proc3 number;
v_result number;
my_exception exception;
procedure proc1
is
begin
select 8/0 into variable_proc1 from dual;
exception
when others
then raise my_exception; ----line 20
end;
procedure proc2
is
begin
select 1 into variable_proc2 from dual;
exception
when others
then
null;
end;
procedure proc3
is
begin
select 3 into variable_proc3 from dual;
exception
when others
then
null;
end;
Procedure caller_proc
is
begin
proc1;
proc2;
proc3;
v_result:=variable_proc2+variable_proc3;
dbms_output.put_line('The output is '||v_result);
exception
when my_exception
then
dbms_output.put_line('Heyyyyy the error is '||SQLERRM); -- exception caught at line 64 of caller proc
end;
end mypackage;
When i try executing the caller proc, i don't get the error. Instead i get the text User-Defined Exception as shown below
set serveroutput on
exec mypackage.caller_proc;
Heyyyyy the error is User-Defined Exception
PL/SQL procedure successfully completed.Edited by: user10633418 on Mar 10, 2009 11:30 PMThank you justin.
Sorry my earlier post was a bit ambiguous.
I wanted the error generated at proc1 to be captured at caller proc's Exception handling section (line 64) so that i could log the error to an ERR_LOG table.
I can actually log this error at proc1 itself like
exception
when others
THEN
error_message :='My custom message for the particular proc '||SQLERRM;
dbms_output.put_line(error_message);
logerror(error_message); --an autonomous error logging proc
raise;But there is a RAISE statement in proc1's exception handling, so the exception gets propogated to caller proc's exception handling section {color:#ff0000}*and another redundant row will be created at ERR_LOG table for the same error because there is a*{color}
logerror(error_message);--an autonomous error logging proc
in the WHEN OTHERS section of exception handling section of the caller proc
I want to avoid the creation of this redundant row in ERR_LOG table. -
Select from sys table in package procedure
Is it possible to use a table in the SYS schema in a procedure defined in a package?
Right now, these errors are raised:
SQL> SHOW ERRORS PACKAGE BODY App_security_context;
Errors for PACKAGE BODY APP_SECURITY_CONTEXT:
LINE/COL ERROR
17/3 PL/SQL: SQL Statement ignored
18/8 PLS-00201: identifier 'SYS.DBA_ROLE_PRIVS' must be declared
eg)
CREATE OR REPLACE PACKAGE App_security_context IS
PROCEDURE Set_restrictions;
END App_security_context;
CREATE OR REPLACE PACKAGE BODY App_security_context IS
PROCEDURE Set_restrictions
IS
data_code VARCHAR2(16);
BEGIN
SELECT MD_SYS_USER_DATA_CODE.code_id INTO data_code
FROM
MD_SYS_USER_DATA_CODE
, SYS.DBA_ROLE_PRIVS
WHERE SYS.DBA_ROLE_PRIVS.grantee = SYS_CONTEXT('USERENV', 'SESSION_USER')
AND SYS.DBA_ROLE_PRIVS.granted_role = MD_SYS_USER_DATA_CODE.role_id;
DBMS_SESSION.SET_CONTEXT('app_entry', 'data_code', data_code);
END Set_restrictions;
END App_security_context;You need the select grant on the SYS view granted directly to you - not through a role. See here for more details:
http://osi.oracle.com/~tkyte/Misc/RolesAndProcedures.html -
Dump with raise not_found.
Hi,
program LCODBU02 dumping when i execute MF60.
it shows in dump analysis '
A RAISE statement in the program "SAPLCODB" raised the exception
condition "NOT_FOUND".
Since the exception was not intercepted by a superior
program, processing was terminated.
exception NOT_FOUND is declared in function module and in code they are writing raise statement.
why it dumps and is there any replacementCheck if you current support package level contains the correction of the following notes/corrections:
http://service.sap.com/notes
--> search for "order_not_found raise_exception"
--> sort by date
Markus -
ST03N Raise Exception Shortdump when Access BI Workload
Dear Experts,
Now i'm using BI 7.0 for SEM-BPS purposes. SAP Support package i used now is
SAPKB70013, SAPKA70013, SAPKIPYJ7D, SAPKW70015, SAPK-60010INFINBASIS, SAPKGS6010 and SAPKIBIIP6.
I have problem when try to check BI Workload via Transaction ST03N, "RAISE_EXCEPTION" shortdump always occured when i double click one of workload date. From ST22, mentioned that the errors is related with "SAPLRSDRI" or "LRSDRIU01" or "RSDRI_INFOPROV_READ".
FYI this short dump didn't occured before i upgraded my system from Suport package 12 to support package 13. I have tried to implement notes number 1088281 (RAISE_EXCEPTION in RSDRI_INFOPROV_READ) and 1002054 (Dump when reading master data providers) but the shordump still occured. Is there any other solution for this? Any help will be highly apreciate.
Below is the summary of the shortdump.
==========================================================
Runtime Errors RAISE_EXCEPTION
Date and Time 11.12.2007 10:55:04
Short text
Exception condition "X_MESSAGE" raised.
What happened?
The current ABAP/4 program encountered an unexpected
situation.
Error analysis
A RAISE statement in the program "SAPLRSDRI" raised the exception
condition "X_MESSAGE".
Since the exception was not intercepted by a superior
program, processing was terminated.
Short description of exception condition:
Other Error from Deeper Modules
For detailed documentation of the exception condition, use
Transaction SE37 (Function Library). You can take the called
function module from the display of active calls.
How to correct the error
If the error occures in a non-modified SAP program, you may be able to
find an interim solution in an SAP Note.
If you have access to SAP Notes, carry out a search with the following
keywords:
"RAISE_EXCEPTION" " "
"SAPLRSDRI" or "LRSDRIU01"
"RSDRI_INFOPROV_READ"
or
"SAPLRSDRI" "X_MESSAGE"
or
"SAPWL_ST03N " "X_MESSAGE"
Information on where terminated
Termination occurred in the ABAP program "SAPLRSDRI" - in
"RSDRI_INFOPROV_READ".
The main program was "SAPWL_ST03N ".
In the source code you have the termination point in line 160
of the (Include) program "LRSDRIU01".
============================================================
Thanks,
BagusSolution for as was:
Check RSA1 Data Warehouse Workbench -> Modeling -> InfoProvider;
- Search for InfoCube 0TCT_VC01; in the context, check "Activate
Direct Access"; Then, click on the "Source Syst.for InfoSource 3.x"
tab, you have to activate the direct access by marking the source
system (system name) and save.
In ST03N get Short dump exception conditon"x_message"raised
Cheers,
Pavel -
Hi ,
begin
Execute immediate 'ALTER PACKAGE OU_TERRITORY_LOOKUP Compile PACKAGE ' ;
end;-24344 ORA-24344: success with compilation error
-24344 ORA-24344: success with compilation error
wht is ti mean ? how it can be success if it's errors ???
thanks in advance
Rajinfant_raj wrote:
-24344 ORA-24344: success with compilation error
wht is ti mean ? how it can be success if it's errors ???The compile command was accepted (it was successful in initiating a compilation of the requested object). However, the object itself failed to compile - that part was unsuccessful.
24344, 00000, "success with compilation error"
// *Cause: A sql/plsql compilation error occurred.
// *Action: Return OCI_SUCCESS_WITH_INFO along with the error code
//Example. The package has a function that refers to an object that the package does not have select access to. The package is created in the example and then compiled (again) using PL/SQL and dynamic SQL. The USER_ERRORS view is then used to determine what errors there are in the package.
SQL> create or replace package FooTest as
2 function version return varchar2;
3 end;
4 /
Package created.
SQL>
SQL> create or replace package body FooTest as
2 function version return varchar2 is
3 ver varchar2(20);
4 begin
5 select i.version into ver from v$instance i;
6 return( ver );
7 end;
8 end;
9 /
Warning: Package Body created with compilation errors.
SQL>
SQL>
SQL> begin
2 execute immediate 'alter package FooTest compile';
3 exception when OTHERS then
4 dbms_output.put_line( 'package FooTest failed to compile successfully' );
5 raise;
6 end;
7 /
package FooTest failed to compile successfully
ERROR:
ORA-24344: success with compilation error
ORA-06512: at line 5
Warning: PL/SQL compilation errors.
SQL>
SQL> select
2 e.name, e.type, e.line, e.text
3 from user_errors e
4 where e.name = 'FOOTEST' order by 1,2,3;
NAME TYPE LINE TEXT
FOOTEST PACKAGE BODY 5 PL/SQL: SQL Statement ignored
FOOTEST PACKAGE BODY 5 PL/SQL: ORA-00942: table or view does not exist
SQL> -
SSIS 2012 package runs under SSDT but fails with permission error from SSMS
I have a simple package that pulls data from a text file located on a Windows file server that runs successfully from SSDT on my client.
However, when deployed and running the package via SSMS from the client, the package fails with a permission error, with the error stating that the data file could not be opened.
I have done some investigation and have seen some info that states that a package run from SSMS runs under the account on which you are logged on to the machine, which I would have thought is correct. This is therefore the same account when running from
SSDT (which works) and I can see from the SSIS Report that the 'Caller' is stated as my account, so if this is the case why isin't the package working.
I've also seen an MSDN forum answer which stated the opposite that the package when run from the IS Catalog in SSMS doesn't run under the account on which the client is logged on with, which is the opposite of the above, but doesn't indicate which account
it is using.
So what account is being used to run SSIS 2012 packages from the IS catalog from within SSMS ?
If it is the account on which you are logged onto the client running SSMS, why is it not working when the account has the necessary permissions (as provent when running from SSDT) ?I am aware it's using my account and not one of the service. There's nothing in the posts above which suggests I'm using the service account. I don't know why people keep assuming that I'm running the package from a job. I've never stated that in any of
the posts I'm running the package from a job. It's been made quite clear I'm running the package from the IS Catalog on SSMS:
"This is simply selecting a package from the IS Catalog, right-clicking and selecting Execute package.", as per the Nov 18 post, and in the original post "....So what account is being used to run SSIS 2012 packages from the IS catalog from
within SSMS".
Just to be clear, the package is NOT being run from a job. It's using the Execute package option when selecting the package within SSMS from the IS Catalog and it's running under the account on which I am logged on to my client.
Please read carefully. I was just answering your question "So what account is being used to run SSIS 2012 packages from the IS catalog from within SSMS ?" and stating that you where right and that it uses your account to run the package
when you execute a package manually from the Catalog and that you can prove that by logging the system variable.
A good suggestion about using a share in the task to map the drive and I will try this. I would find it strange that SSMS requires this mapping whereas SSDT does not though.
Ok let us know your findings. If it doesn't work you can also test it with a password and username:
net use f: \\financial\public yourpassword /user:username
Please mark the post as answered if it answers your question | My SSIS Blog:
http://microsoft-ssis.blogspot.com |
Twitter -
I have a web application developed through VS 2012 which has a button on a form that when operated starts a SQL Server agent job on the server that runs an SSIS package. The website and the instance of SQL Server with the agent and SSIS package are
on the same windows 2008 r2 server. When the button is operated no exceptions are raised but the SSIS package did not execute.
When I look in the logfileviewer at the job history of the sql server agent job I see that the job failed with message...
The job failed. Unable to determine if the owner (DOMAINNAME\userid) of job runWebDevSmall has server access (reason: Could not obtain information about Windows NT group/user 'DOMAINNAME\userid'<c/> error code 0x6e. [SQLSTATE 42000] (Error 15404)).,00:00:00,0,0,,,,0
...even though DOMAINNAME\userid is in the logins for the sql server and has admin authorities.
Could someone show me what I need to do to get this to run? Thanks tonnes in advance for any help, RoscoeThis can happen when the network is too slow to allow a timely completion of the verification. Or the account running has no such right.
I suggest you try using the SA account for the job as it does not require to poll the AD.
Arthur My Blog -
Calling Oracle Package Function from Visual Basic
Hi,
Oracle Client 8.04
Oracle ODBC Driver 8.00.04
VB 6.0
Windows 2000
I'm stumped here. I want to have a Oracle stored procedure run a
query and return a result set which I can assign to a recordset
object in VB. Based on things I've read here and on MS's site,
here's what I've done:
In the Oracle Schema Manager under the Packages folder I created
the following package:
PACKAGE test
IS
TYPE test_cur IS REF CURSOR;
FUNCTION mycur RETURN test_cur;
END test;
and under the Package Body folder created:
PACKAGE BODY test
IS
FUNCTION mycur RETURN test_cur
IS
c_return test_cur;
BEGIN
OPEN c_return FOR
SELECT * FROM table_A;
RETURN c_return;
CLOSE c_return;
END mycur;
END test;
They both compile without errors and in Oracle SQL Worksheet I
can enter the following:
variable x refcursor;
execute :x :=test.mycur;
print x;
and the query results are displayed as expected.
The problem is trying to get the result back into a VB recordset
object.
In VB 6.0 I have done this:
Dim RS As ADODB.Recordset
Dim Conn As ADODB.Connection
Dim sConnection As String
Dim sSQL As String
sSQL = "{call test.mycur}"
sConnection = "Provider=MSDASQL;UID=" & sUserID & ";PWD=" &
sPassword & ";Driver={Microsoft ODBC for Oracle}; Server=" &
sInstance & ";"
Conn.Open sConnection
RS.CursorLocation = adUseClient
RS.Open sSQL, Conn, adOpenForwardOnly, adLockOptimistic,
adCmdStoredProc ' or adCmdText
but get:
?err.Number -2147217900
?err.Source Microsoft OLE DB Provider for ODBC Drivers
?err.Description [Microsoft][ODBC driver for Oracle]Syntax error
or access violation
The problem is not with the connection or permissions, since the
query works fine when I just use the select statement in the
package function as the string, instead of calling the function
in the package (eg sSQL = "Select * from table_A") and can
process the resulting recordset in VB.
I've also tried variations using:
Set RS = Conn.Execute("{call test.mycur}")
or using a Command object something like:
Dim com As ADODB.Command
Set com = New ADODB.Command
With Conn
.ConnectionString = sConnection
.CursorLocation = adUseClient
.Open
End With
With com
.ActiveConnection = Conn
.CommandText = sSQL
.CommandType = adCmdText
End With
Set RS.Source = com
RS.Open
But still get the same errors. Any help is appreciated. Also, in
my package body, is it necessary to explicitly close the cursor,
or does the function just exit when it executes the return and
not ever hit the close statement?
Thanks,
Ed HollomanHi
i don't know if you got your answer, but i work with VB and
Oracle.
the procedure in the DB should have the cursor like you writen
in your mail.
to call a procedure in Oracle and get the data back
into a recordset you shuld use a Command object like this:
Dim conn As ADODB.Connection
Dim cmd As ADODB.Command
Dim rs As ADODB.Recordset
Set conn = CreateObject("adodb.connection")
Set cmd = CreateObject("adodb.command")
Set rs = CreateObject("adodb.recordset")
With conn
.ConnectionString = ""
.CursorLocation = adUseClient
.Open
End With
'THE IMPORTENT SECTION IS THIS WHERE YOU SET THE COMMAND TO THE
STORE PROCEDURE TYPE
With cmd
.ActiveConnection = conn
.CommandText = "proc.fun"
.CommandType = adCmdStoredProc
End With
'Then you set the rs to the command
Set rs = cmd.Execute
Set conn = Nothing
Set rs = Nothing
Set cmd = Nothing
Maybe you are looking for
-
10.5 Server : Standard Installation : Newbie Tutorial / Setup Walk-Through
Hello all, I recently setup OS X Server 10.5 for a client after doing it many times at my home. I could not have possibly done it without the help of this discussion board so thanks to everyone asking and answering questions! To help other server new
-
How to set a common page for all users after loging on?
hi all, Now "My Dashboard" is the default page after logon. i want to set a default home page for all users. users can see the home page after loging on. how to change the default dashboard from "My Dashboard" to "Home page" for all users? thanks, da
-
Is there any documentation on taxes map back to B1
In SAP B1 we have the taxes at the lowest level defined at the COUNTY level since the customers are US customers. This is the SALES TAX CODE configuration in B1. Does the 'TAX CODE' in ECOMMERCE map back to the SALES TAX CODE in B1? If that is the c
-
Enable 802.11n - Need your inputs
Okay Guys need your input I've heard that if you want to enable High Speed WLAN connection such as 802.11n you need to have you security settings as WPA2 and AES Is this true?
-
D110a loss of communicat​ion on 1 computer in a network
I have a home network with 2 destops and a laptop. There is one desktop that doesn't work all the time with the printer. I've unistalled and reinstalled the software several times but nothing seems to work. Yesterday I did that process again. I got