Datapump from procedure
I am wanting to do a datapump from a procedure. Ever time i run my procedure i get a error that says "job does not exist" From what i read online i thougt i could set my procedure up like this but i guess i cant. Thanks for the help
PROCEDURE "NIGHTLY_SCHEMA_EXPORT" AS
l_dp_handle NUMBER;
l_last_job_state varchar2(30) := 'UNDEFINED';
l_job_state varchar2(30) := 'UNDEFINED';
l_sts KU$_STATUS;
begin
l_dp_handle := DBMS_DATAPUMP.OPEN(
operation => 'EXPORT',
job_mode => 'SCHEMA',
remote_link => NULL,
job_name => 'EMP_EXPORT',
version => 'LATEST');
DBMS_DATAPUMP.add_file(
handle => l_dp_handle,
filename => 'NIGHTLY_SCHEMA_EXPORT.DMP',
directory => 'WRITABLE_DIRECTORY');
DBMS_DATAPUMP.metadata_filter(
handle => l_dp_handle,
name => 'SCHEMA_EXPR',
value => '=''VFT''');
DBMS_DATAPUMP.start_job(l_dp_handle);
DBMS_DATAPUMP.detach(l_dp_handle);
end;
This is the complete error that i am getting
ORA-31626: job does not exist
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
ORA-06512: at "SYS.DBMS_DATAPUMP", line 911
ORA-06512: at "SYS.DBMS_DATAPUMP", line 4356
ORA-06512: at "DALLAS.NIGHTLY_SCHEMA_EXPORT", line 8
ORA-06512: at line 2
I have the same problem with a similar job:
declare
n_handle number;
begin
n_handle := dbms_datapump.open('EXPORT','SCHEMA',NULL,'REFRESH KONLOG','VALID');
end;
the error message is:
[1]: (Error): ORA-31626: job does not exist ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79 ORA-06512: at "SYS.DBMS_DATAPUMP", line 820 ORA-06512: at "SYS.DBMS_DATAPUMP", line 3742 ORA-06512: at line 4
any ideas thanks in advance
Andreas
Similar Messages
-
How to get return type as Table of Index by BINAR from Procedure using JDBC
Hi,
We have stored procedure which takes Varchar as input and rerurn muiltiple recored of type Table of index by BINARY
We created the procedure with in a package, its header part like below:
CREATE OR REPLACE PACKAGE emp_pkid_pkg
AS
TYPE r_emp IS RECORD ( employe_profile_id NUMBER
, client_profile_id VARCHAR2(240)
, email VARCHAR2(240)
, terms_acp VARCHAR2(1)
TYPE tp_emp_profile IS TABLE OF r_emp INDEX BY BINARY_INTEGER;
PROCEDURE er_employe_prov_profile ( e_inxid employe_provision_instance.inxid%TYPE
, e_emp_recs OUT tp_emp_profile
END emp_pkid_pkg;
This procedure has body part, wich has origial business logic like below.
CREATE OR REPLACE PACKAGE BODY emp_pkid_pkg
AS
PROCEDURE pr_customer_prov_profile ( e_inxid employe_provision_instance.inxid%TYPE
, e_emp_recs OUT tp_customer_provision_profile
IS
CURSOR c_emp_prov_instance ( c_guid employe_provision_instance.guid%TYPE )
etc ...
END emp_pkid_pkg;
We could execute the below script from oracle client tool and get the response.
DECLARE
e_cust emp_pkid_pkg.tp_emp_profile;
BEGIN
emp_pkid_pkg.er_employe_prov_profile ( 'ef45t6543y98'
, e_cust
FOR i in e_cust.FIRST..e_cust.LAST LOOP
DBMS_OUTPUT.PUT_LINE ( e_cust(i).employe_profile_id
||'#'|| e_cust(i).client_customer_id
||'#'|| e_cust(i).email
||'#'|| e_cust(i).term_acp);
END LOOP;
END;
We have requirement to get the results from procedure usind JDBC callable statement call.
We have tried to call the procedure via JDBC callable statement but it didn't work.
We have constructed it like the following. It was throwing error "java.sql.SQLException: invalid column type: emp_pkid_pkg.tp_emp_profile
CallableStatement cs2 = con.prepareCall("{call emp_pkid_pkg.er_employe_prov_profile(?,?)}");
cs2.registerOutParameter(2, OracleTypes.CURSOR, emp_pkid_pkg.tp_emp_profile);
cs2.setString(1,empId);
Not sure whether I am doing the logic correctly. But i tryed with diff type. Still am getting same error like above.
Please point me to the correct approach.
Thanks
Edited by: 921689 on 18-Mar-2012 17:20>
We have requirement to get the results from procedure usind JDBC callable statement call.
>
Can't be done - the reason has nothing to do with JDBC so you are in the wrong forum.
Repost in the PL/SQL forum and I can give you an example of what you have to do
PL/SQL
First the TYPEs you defined are PL/SQL types so can't be referenced outside PL/SQL; you need to define SQL types.
Second you will need to use a procedure that returns a REF CURSOR or is a PIPELINED procedure. Since your procedure doesn't fall into either category you can't use it with JDBC to do what you want.
If your query was a PIPELINED function then you could simply query it like it was a table. I have a PIPELINED function name 'get_emp' so this works.
select * from table(get_emp(30));Post in the PL/SQL forum and I can give you the code for the procedure. I'm not going to clutter up this forum with inappropriate material. -
Hi
Is possible call a RFC (R3 SAP) from procedure/package ?
TiaHi,
Yeah, it is possible to call a RFC from Oracle Procedures with the user
of proper supplied packages rfcsdk or by use of Java Connector. -
Problem call Dll C from procedure
Hi all, I have dll write by C and with function A(String[] param). I want call this is function from procedure on Oracle. Please help me step to step do it.
Thank you so much.MobizCOM jsc wrote:
The pszParams is an array of pointers to 4 strings (char **), and it is an IN/OUT parameter. It means we need to pass an array of string to external function in the dll, then the external update the array as an output parameter. After return to PL/SQL, we need to extract the updated values in the array to continue process.
In my understanding, the most appropriate datatype with this in PL/SQL is "TABLE OF VARCHAR2". But it is a kind of collection. Does Oracle support to pass this datatype to external function?No.
It is a mistake in thinking that an Oracle array will be a byte copy of how C represents an array in memory.
We have tried to create a dll with simple function, simple parameters and it works. It seems that our configure for listener.ora are correctly.Correct. Which means it is now much simpler to focus on the actual challenge - passing data between the PL engine and a DLL using compatible data structures.
I have done some basic testing with array types and PL and C do not seem to match at all in this respect. Which meant I defaulted to using scalar data types and variables only.
You can point your browser to [http://tahiti.oracle.com|http://tahiti.oracle.com] and do some research yourself. There should be documentation describing the compatibility between PL and C data types.
You can also use Pro*C to see what Oracle's precompiler does. It does a 2 step compilation - so Pro*C compiles the Pro*C code (C + SQL) into C source and then that gets compiled with the normal C compiler. Peeking at the C source code generated by Pro*C may provide better insights in how SQL and PL/SQL data types and mapped to C data types and vice versa.
As for performance - in this case optimal performance is staying inside the PL engine and not stepping (context switching) to an external process interfacing with an external DLL. Therefore it would be best to replicate the functionality provided by that DLL into PL/SQL as far as possible. -
How return parameter ref Cursor from procedure using dynamic SQL?
I sorry, but i very need help.
I using Oracle 8.0.6
I need to return parameter of type ref Cursor from procedure.
create or replace package PlanExp is
type cursortype is ref cursor;
procedure ShowPlan (cursorparam out
cursortype.............);
end PlanExp;
create or replace package body PlanExp is
procedure ShowPlan (cursorparam out cursortype,
.............) Is
sql_str varchar2(1000);
sql_str_select varchar2(100);
sql_str_from varchar2(100);
sql_str_where varchar2(500);
Return_Code integer;
Num_Rows integer;
cur_id_sel integer;
tSum_Plan DBMS_SQL.NUMBER_TABLE;
tSum_Plan_Ch DBMS_SQL.NUMBER_TABLE;
tSum_Plan_Day DBMS_SQL.NUMBER_TABLE;
begin
/* calculating string variables ........... /*
sql_str := 'select ' || sql_str_select ||
'from ' || sql_str_from ||
'where ' || sql_str_where ||
'group by ' || sql_str_select;
cur_id_sel := dbms_sql.open_cursor;
dbms_sql.parse(cur_id_sel, sql_str, dbms_sql.native);
dbms_sql.define_array(cur_id_sel, 1, tSum_Plan, 20, 1);
dbms_sql.define_array(cur_id_sel, 2, tSum_Plan_Ch, 20, 1);
dbms_sql.define_array(cur_id_sel, 3, tSum_Plan_Day, 20, 1);
Return_Code := dbms_sql.execute(cur_id_sel);
delete from TEMP_SHOWPLAN;
Loop
Num_Rows := dbms_sql.Fetch_Rows(cur_id_sel);
dbms_sql.column_value(cur_id_sel, 1, tSum_Plan);
dbms_sql.column_value(cur_id_sel, 2, tSum_Plan_Ch);
dbms_sql.column_value(cur_id_sel, 3, tSum_Plan_Day);
if Num_Rows = 0 then
exit;
end if;
Exit When Num_Rows < 20;
End Loop;
dbms_sql.close_cursor(cur_id_sel);
end;
end PlanExp;
How return cursor (cursorparam) from 3 dbms_sql.column_value-s ?I am using Oracle 8.1.7, so I don't know if this will work in
8.0.6 or not:
SQL> CREATE TABLE test
2 (col1 NUMBER,
3 col2 NUMBER,
4 col3 NUMBER)
5 /
Table created.
SQL> INSERT INTO test
2 VALUES (1,1,1)
3 /
1 row created.
SQL> INSERT INTO test
2 VALUES (2,2,2)
3 /
1 row created.
SQL> INSERT INTO test
2 VALUES (3,3,3)
3 /
1 row created.
SQL> CREATE TABLE temp_showplan
2 (tSum_Plan NUMBER,
3 tSum_Plan_Ch NUMBER,
4 tSum_Plan_Day NUMBER)
5 /
Table created.
SQL> EDIT planexp
CREATE OR REPLACE PACKAGE PlanExp
IS
TYPE CursorType IS REF CURSOR;
PROCEDURE ShowPlan
(cursorparam IN OUT CursorType,
sql_str_select IN VARCHAR2,
sql_str_from IN VARCHAR2,
sql_str_where IN VARCHAR2);
END PlanExp;
CREATE OR REPLACE PACKAGE BODY PlanExp
IS
PROCEDURE ShowPlan
(cursorparam IN OUT CursorType,
sql_str_select IN VARCHAR2,
sql_str_from IN VARCHAR2,
sql_str_where IN VARCHAR2)
IS
sql_str VARCHAR2 (1000);
cur_id_sel INTEGER;
return_code INTEGER;
BEGIN
DELETE FROM temp_showplan;
sql_str := 'INSERT INTO temp_showplan '
|| ' SELECT ' || sql_str_select
|| ' FROM ' || sql_str_from
|| ' WHERE ' || sql_str_where;
cur_id_sel := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE (cur_id_sel, sql_str, DBMS_SQL.NATIVE);
return_code := DBMS_SQL.EXECUTE (cur_id_sel);
DBMS_SQL.CLOSE_CURSOR (cur_id_sel);
OPEN cursorparam FOR SELECT * FROM temp_showplan;
END ShowPlan;
END PlanExp;
SQL> START planexp
Package created.
Package body created.
SQL> VARIABLE g_ref REFCURSOR
SQL> EXEC PlanExp.ShowPlan (:g_ref, 'col1, col2,
col3', 'test', ' 1 = 1 ')
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
TSUM_PLAN TSUM_PLAN_CH TSUM_PLAN_DAY
1 1 1
2 2 2
3 3 3 -
How to out Dynamic ref cursor from Procedure to Forms
Hi
I am trying to out Dynamic ref cursor from Procedure to Forms, But I am unable to do so. however cursor return the value within procedure but I am failed to capture the same in Forms
Pl advice suggestion if any, Here I am attaching full procedure for reference
CREATE PACKAGE winepkg
IS
TYPE wine IS RECORD ( mynumber number);
/* Define the REF CURSOR type. */
TYPE wine_type IS REF CURSOR RETURN wine;
END winepkg;
CREATE procedure find_wine
(col1_in in number,
c1 out winepkg.wine_type) as
vsql varchar2(1000);
cur sys_refcursor;
x number;
BEGIN
vsql:='select bo_id from bo_details where bo_details.bo_id = '||col1_in ;
open cur for vsql;
c1:=cur;
--fetch c1 into x;
--dbms_output.put_line(x);
END find_wine;
In front end forms
Declare
TYPE F is REF CURSOR;
CUR_F F;
rec number;
Begin
break;
find_wine( 1601480000011078,cur_f ) ;
Loop
fetch cur_f into rec ;
Message(rec ) ;pause;
exit when cur_f%notfound ;
End loop ;
exception
when others then
Message(sqlerrm) ;pause;
End ;yo can use
declare
c_cursor EXEC_SQL.CursType;
v_stmt varchar2(2000) = 'select a, b, c from mytab where cond1'; -- you can create this value dynamically
begin
c_cursor := Exec_SQL.Open_cursor;
EXEC_SQL.PARSE(c_articulos, v_stmt);
EXEC_SQL.DEFINE_COLUMN(c_articulos,1, v_colchar1, 30);
EXEC_SQL.DEFINE_COLUMN(c_articulos,2, v_colchar2, 15);
EXEC_SQL.DEFINE_COLUMN(c_articulos,3, v_colchar3, 30);
v_exec := EXEC_SQL.EXECUTE(c_cursor);
WHILE EXEC_SQL.FETCH_ROWS(c_cursor) > 0 LOOP
EXEC_SQL.COLUMN_VALUE(c_cursor,1,v_colchar1);
EXEC_SQL.COLUMN_VALUE(c_c_cursor,2,v_colchar2);
EXEC_SQL.COLUMN_VALUE(c_c_cursor,3,v_colchar3);
assign_values_to_block;
END LOOP;
EXEC_SQL.CLOSE_CURSOR(c_cursor);
end;
and WORKS IN FORMS 6 -
Need to refresh materialized view from procedure and pl/sql block
Hi,
I need to refresh materialized view (complete refresh)from procedure and pl/sql block .can some one help.
MV name:MV_DGN_TEST_SESSION
Thanks,
Rajasekhardbms_mview.REFRESH ('MV_DGN_TEST_SESSION', 'C');Regards,
Mahesh Kaila
Edited by: user4211491 on Dec 1, 2009 10:41 PM -
How to create data_block from procedure ?
hi all
can anyone to help me :
how to create data_block from procedure ?
i want to join 2 or 3 table and use order by
then show some field in my form
i can not use view because order by can not use in view
please send sample code for this procedure
thanks.1) >i can not use view because order by can not use in view
SQL>create or replace view V_test as
2 select * from (
3 select 1 id from dual union
4 select 2 id from dual union
5 select 3 id from dual union
6 select 4 id from dual union
7 select 5 id from dual union
8 select 6 id from dual ) t
9 order by t.id
10 /
View created.
SQL>select * from v_test;
ID
1
2
3
4
5
6
6 rows selected.2). >how to create data_block from procedure?
You must create procedure and use ref cursor. -
Call URL from procedure?
Hi
We have a Crystal Report Server which hosts Crystal Report and now we want to invoket report from PL/SQL procedure/function is it possible.
Means Is it possible to invoke report by calling report URL from procedure or function.
Thanks,
KuldeepYou can certainly use UTL_HTTP to call a URL from a procedure. It's not obvious to me, though, whether that is all you need or whether you need to close the loop (i.e. respond to the results of the report) which may be more challenging.
Be aware, of course, that calls via UTL_HTTP are not transactional, so it is entirely possible that the transaction that initiated the call could be rolled back after the UTL_HTTP call was made. For that reason, folks will commonly have a separate job that calls UTL_HTTP asynchronously after the triggering transaction commits.
Justin -
Retrive MultiRow Result Set From Procedure
Hi,
Can you please guide me, on ways to retrieve result set with more than one row from procedure. I got two ways...
1. Using Ref Cursor &
2. Using Collection
Do we have any other ways also to do this.
Thanks,
Ashish
Edited by: Ashish Thakre on May 28, 2013 10:32 PMHi this is the Oracle Designer forum. You would be better off at the PL/SQL/SQL place
-
How can i execute trigger from procedure
Hi
How can i execute trigger when-button-pressed from procedure.
I knew i have to get the button name and then execute the trigger When-button-pressed.
but how can i do that.
Thanks
nullhow can i execute trigger
such as When-Button-Pressed on item name "item1"
and i have more than one trigger with this name on onther
items
i know Execute_Trigger('when-button-pressed');
but any trigger
for example :
Execute_Trigger('Item1.when-button-pressed');
or
Execute_Trigger('Item2.when-button-pressed');
or
other syntax
i dont know
please help me
my email : [email protected]
Hani -
Hello !!!
How execute from procedure the next:
@oem_exec_template.sql MY_RUNTIME MY_WAREHOUSE PLSQL MY_MAPPING "," ","
because I execute from crons tabs
heplHi,
do you want to use PL/SQL?
Then take a look at WB_RT_API_EXEC.RUN_TASK (see http://download.oracle.com/docs/cd/B31080_01/doc/owb.102/b28225/api_4sqlforjobs.htm#BABFFCHB).
Regards,
Oliver -
How to return cursor from procedure to jdbc
plz help me through example of code as wl as procedure where.... return cursor from procedure to jdbc
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
CREATE procedure anil3 @count INT OUT,@opcode INT OUT,@total_tiff INT OUT
as
declare @query2 varchar(300),@tiff_count int,@query1 varchar(300)
set @query1='declare move_cursor cursor forward_only static for
select count(opcode),opcode from TABLE1 group by opcode
open move_cursor'
exec(@query1)
fetch next from move_cursor into @count,@opcode
set @opcode="'"+@opcode+"'"
set @total_tiff=0
while (@@fetch_status=0)
begin
set @query2='declare move_cursor2 cursor static for '+
' select count(tiff) from TABLE2 where opcode='+@opcode+
' open move_cursor2 '
exec(@query2)
fetch next from move_cursor2 into @tiff_count
while (@@fetch_status=0)
begin
set @total_tiff=@total_tiff+@tiff_count
fetch next from move_cursor2 into @tiff_count
end
close move_cursor2
deallocate move_cursor2
print @total_tiff
print @count
print @opcode
fetch next from move_cursor into @count,@opcode
end
close move_cursor
deallocate move_cursor
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO******************************************************************************
above this is sql server 2000 PL/SQL and i hv to get the value
print @total_tiff
print @count
print @opcode
through JDBC
plz help me out how to return Cursor to JDBC and HOW toPRINT THESE THREE VALUE @total_tiff, @count, @opcode through JDBC
get this values through JDBC -
Within a PL/SQL stored procedure, if an execution error occurrs, I want to receive a corresponding email to notify me as such. How can I do it?
procedure p_exe_error(
begin
//If there is an error, send email to [email protected] to notify the error (error_message =xxxxxxxxxx)
What should I do here?
end;
Thanks
ScottThis appears to be a duplicate
Send out Email from Procedure
Justin -
Calling Procedure B from Procedure A having parameters
Hi,
I have two procedures, I m registering first procedure as a concurrent program like XXXpackage.main
I want to call Procudure new_segments_id from Procedure main.
I need l_old_id parameter for new_segments_id procedure, so I m passing to main procedure.
Now, how should i call new_segments_id procedure from main procedure.
Procedure main(
errbuf OUT VARCHAR2
,retcode OUT VARCHAR2
,l_old_id IN NUMBER
Procudure new_segments_id(l_old_id IN NUMBER
,l_new_id OUT NUMBER
Thanks.Not sure if this is what exactly you want but below is an example of propagation of OUT parameters of one procedure as IN parameters to the another procedure within the same package.
SQL> CREATE OR REPLACE
2 PACKAGE PACKAGE_TEST
3 AS
4 PROCEDURE procedure_1(
5 out_ename OUT VARCHAR2);
6 PROCEDURE procedure_2(
7 v_ename VARCHAR2);
8 END PACKAGE_TEST;
9 /
Package created.
SQL> CREATE OR REPLACE
2 PACKAGE body package_test
3 IS
4 PROCEDURE procedure_1(
5 out_ename OUT VARCHAR2)
6 AS
7 v_ename VARCHAR2(200) := 'SMITH' ;
8 BEGIN
9 SELECT
10 ename
11 INTO
12 out_ename
13 FROM
14 emp
15 WHERE
16 ename = v_ename;
17 DBMS_OUTPUT.PUT_LINE('PROCEDURE 1');
18 procedure_2(out_ename);
19 END;
20
21 PROCEDURE procedure_2(
22 v_ename VARCHAR2)
23 IS
24 v_count number;
25 BEGIN
26 DBMS_OUTPUT.PUT_LINE('PROCEDURE 2');
27 dbms_output.put_line(V_ENAME);
28 select count(*) into v_count from emp where ename = v_ename;
29 dbms_output.put_line('COUNT is ' || v_count);
30 END;
31 END;
32
33 /
Package body created.
SQL> DECLARE
2 ENAME VARCHAR2(5);
3 BEGIN
4 package_test.procedure_1(ENAME);
5 END;
6 /
PROCEDURE 1
PROCEDURE 2
SMITH
COUNT is 1
PL/SQL procedure successfully completed.
Ishan.
Maybe you are looking for
-
Dynadock VGA - monitor suddenly freezes and disappears
OK, perhaps a bit cryptic. What happens is this: I have a Zepto Znote notebook with a GeForce 8600M graphics card. I want to use that as my only computer, but I'm 100 % dependant on a dual monitor setup in my line of work (media work with a video on
-
Printing problem while requesting customer account via FBL5N
Hi All, I have one issue in our production system. When a user request a statement of account for a customer account this is done via transaction FBL5N - environment-correspondence request and the environment-correspondence display. When the display
-
Different aggregation operators for the measures in a compressed cube
I am using OWB 10gR2 to create a cube and its dimensions (deployed into a 10gR2 database). Since the cube has 11 dimensions I set all dimensions to sparse and the cube to compressed. The cube has 4 measures, two of them have SUM as aggregation operat
-
Is it too late to modify preview thumbnails once beforeSave event fires?
My goal: I need to show non-printing layers in my .indd files' preview thumbnails. We produce print jobs which will have post processing applied to them (thermography and cutouts glued to the printed cardstock). Our .indd files have layers containing
-
I have about 12 swfs that I need to put into a Director shell and when I do the buttons on the swfs that link to other swfs work fine but the buttons in the swfs that link to the web don't work at all (neither do the quit buttons on the swfs). I know