An execute query Procedure
Hi guys, I'm starting to work in PL/SQL. I've got some experience in ms
sql server with T-SQL and I'm trying to understand some PL basis.
What
I want to do, is a stored procedure that returns the result of a given
query. Thats a simple thing to do in T-SQL. The code would be:
bq. create procedure runQuery(@someQuery varchar(200)) \\ * as* \\ * exec(@someQuery)* \\ * return*
and the use of it would be:
bq. runQuery 'select 123' \\ * -----------* \\ * 123*
bq. *(1 row(s) affected)*
Now, I'm trying to do the same thing in PL/SQL. What i've written by now is:
bq. CREATE OR REPLACE PROCEDURE RunQuery(someQuery IN VARCHAR2) \\ IS \\ BEGIN \\ EXECUTE IMMEDIATE someQuery ; \\ END; \\ */*
I got a messaje saying "procedure created", but when i try to use the procedure, it doesn't shows any results:
bq. begin \\ RunQuery('select from myTable');* \\ end; \\ */*
I just get a "Statement processed." message with out results.
Any idea of what I'm doing wrong?
thanks in advance
D
As Alex says, forget SQL Server, forget T-SQL as Oracle and PL/SQL are completely different.
If you need a procedure to open a dynamic query and pass the results back, the most usual way for this would be to use a REF CURSOR.
A ref cursor is simply a pointer to a query.
In the following example, the query is passed in to the function as a string. The function then executes (opens) the query and passes back a pointer to the query (the ref cursor)..
SQL> ed
Wrote file afiedt.buf
1 create or replace function exec_query(p_query in varchar2) return sys_refcursor is
2 v_rc sys_refcursor;
3 begin
4 OPEN v_rc FOR p_query;
5 RETURN v_rc;
6* end;
SQL> /
Function created.Now, within SQL*Plus (Oracle's command line SQL interface) we can declare a local variable of REFCURSOR type..
SQL> var x REFCURSOR;And then execute our function assigning the returned ref cursor back into our local variable..
SQL> exec :x := exec_query('select * from emp');
PL/SQL procedure successfully completed.Now, SQL*Plus has a local variable that points to the query, but no data has yet been fetched from it.
In SQL*Plus, to fetch the data we can use the "print" command..
SQL> print x
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
14 rows selected.
SQL>Et voila! our data is returned.
As another example, we can open up and fetch the data within a procedure itself..
SQL> ed
Wrote file afiedt.buf
1 create or replace procedure proc_exec_query(p_query in varchar2) is
2 v_rc sys_refcursor;
3 TYPE t_rec IS RECORD (id NUMBER, name VARCHAR2(50));
4 v_rec t_rec;
5 begin
6 OPEN v_rc FOR p_query;
7 LOOP
8 FETCH v_rc INTO v_rec;
9 EXIT WHEN v_rc%NOTFOUND;
10 DBMS_OUTPUT.PUT_LINE('ID: '||v_rec.id||' NAME: '||v_rec.name);
11 END LOOP;
12 CLOSE v_rc;
13* end;
SQL> /
Procedure created.Within this procedure, you will see that we have to provide a structure for the returned data to go into. This means we have to be aware of what data we expect to be returned from our cursor (there are methods for doing it completely dynamically using the DBMS_SQL package but that's a little more complex for you as a newbie). So, our procedure expects the query to return a number and a string. It then opens the cursor and loops through it, exiting the loop when no more records are found and then closing the cursor when done. For each row we find we can do what we like with the data; in my example it is outputting the information to the databases output buffer. It is then up to something else to read that buffer and display the contents.
For this I will use SQL*Plus again.
To tell SQL*Plus to output any contents that appear in the database output buffer, we issue the following command..
SQL> set serveroutput onIf we don't do this then the output will seemingly disappear into oblivion.
So, now we've switched on the output we can execute our procedure.
Firstly, let's execute it to fetch the Employee numbers and names from the EMP table..
SQL> exec proc_exec_query('select empno, ename from emp');
ID: 7369 NAME: SMITH
ID: 7499 NAME: ALLEN
ID: 7521 NAME: WARD
ID: 7566 NAME: JONES
ID: 7654 NAME: MARTIN
ID: 7698 NAME: BLAKE
ID: 7782 NAME: CLARK
ID: 7788 NAME: SCOTT
ID: 7839 NAME: KING
ID: 7844 NAME: TURNER
ID: 7876 NAME: ADAMS
ID: 7900 NAME: JAMES
ID: 7902 NAME: FORD
ID: 7934 NAME: MILLER
PL/SQL procedure successfully completed.Now let's execute the same procedure to fetch the Department number and names from the DEPT table..
SQL> exec proc_exec_query('select deptno, dname from dept');
ID: 10 NAME: ACCOUNTING
ID: 20 NAME: RESEARCH
ID: 30 NAME: SALES
ID: 40 NAME: OPERATIONS
PL/SQL procedure successfully completed.
SQL>So that's just a couple of ways of doing it, and should help to get you started.
;)
Similar Messages
-
How to execute a procedure depending on the result of a query?
Hello, I'm new in ODI.
I want to execute a procedure depending on the result of a query Oracle table.
We have a Oracle Table whit a column that contains two possibles values.
I want read the table, row by row, and depending on this value, execute a Procedure or execute another.
How can i do?what you need to do is
1. create a variable which "new_var2" which has the count of the number of rows you want to process. must be data type numeric.
2. copy "new_var2" to the package screen.
3. duplicate the "new_var2" on the package screen and evaluate the variable and test for "> 0" zero, call it "new_var2_E"
3. create a new odi variable "new_var1" with a refresh of "select field1 fom (select field1,rownum as rownumber from tablex) where rownumber = #new_var2" in the relevant schema and technology.
4. copy "new_var1" into your package (some where in the flow)
5. right click the "new_var1" variable in you package screen and you should get the option duplicate step (click on that)
6. select the the duplicate "new_var1" on the package screen and correct the the name to something meaning full to you "new_var1_E", also change the "type" to "evaluate variable" then you should see a "value" box. enter one of the values you want to test in the box (remember do not put in quotes ' )
7. now back on the package screen join the "new_var1" to the "new_var1_E" with an OK line
8 you now join "new_var2" to "new_var2_E" with OK
9 you join "new_var2_E" to "new_var1"
10. you then join the "new_var1_E" with an OK or a KO line to the relevant procedure.
12. you need to duplicate "new_var2" in the package screen one more time this time and call it "new_var2_D" set the type to evaluate and then select the increment of -1
13. the relevant procedure to "new_var2_D" with an OK
14. join the "new_var2_D" to the "new_var2_E" with an OK
15. this should close off the loop now the exit point is "new_var2_E" with a KO line to the next part of your process....
Basically you should end up with a loop on new_var2 decementing, and it is used to get a specific next record row from your table.
Hope this helps, sorry it is a little long winded..
Edited by: DavidGD on Feb 8, 2009 3:29 PM -
In JDBC Sender Adapter , the server is Microsoft SQL .I need to pass current date as the input column while Executing stored procedure, which will get me 10 Output Columns. Kindly suggest me the SQL Query String , for executing the Stored Procedure with Current date as the input .
Hi Srinath,
The below blog might be useful
http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/03/06/executing-stored-procedure-from-sender-adapter-in-sap-pi-71
PI/XI: Sender JDBC adapter for Oracle stored procedures in 5 days
regards,
Harish -
Error While executing a procedure
Hello FOlks,
When i try to execute this procedure below i get the error saying "Compiled with errors"
ORA--00942-Table or View does not exist
SQL Statement ignored at Line 17.
I tried querying the table and it returns no data. How do i debug this error.
create or replace procedure Load_FADM_Staging_Area_test(p_data_load_date date) is
v_start_date date;
v_end_date date;
begin
if p_data_load_date is null then
select (sysdate - 7), (sysdate - 1) into v_start_date, v_end_date from dual;
elsif p_data_load_date is not null then
select (p_data_load_date - 7), (p_data_load_date - 1) into v_start_date, v_end_date from dual;
else
raise_application_error('-20042', 'Data control - GetDataControlAuditData : Date parameter must be a date of this or a previous week.');
end if;
insert into STAGE_FADM_HRI_STAGE_BILL
(select
a.batch_id
,a.beginning_service_date
,a.bill_id
,a.bill_method
,a.bill_number
,a.bill_received_date
,a.bill_status
,a.bill_type
,a.change_oltp_by
,a.change_oltp_date
,a.client_datafeed_code
,a.client_id
,a.created_date
,a.date_of_incident
,a.date_paid
,a.deleted_oltp_by
,a.deleted_oltp_date
,a.duplicate_bill
,a.ending_service_date
,a.event_case_id
,a.event_id
,a.from_oltp_by
,a.oltp_bill_status
,a.review_status
,'HRI' schema_name
, sysdate Load_date
,'ETLPROCESS001' Load_user
,sysdate
from stage_bill@hri1_read_only_remote a
where
--created_date >= to_date('20101031 235959', 'YYYYMMDD HH24MISS')
created_date >= v_start_date
and
--created_date <= to_date('20101111 235959', 'YYYYMMDD HH24MISS')
created_date <= v_end_date
and not exists
(select
b.batch_id
,b.beginning_service_date
,b.bill_id
,b.bill_method
,b.bill_number
,b.bill_received_date
,b.bill_status
,b.bill_type
,b.change_oltp_by
,b.change_oltp_date
,b.client_datafeed_code
,b.client_id
,b.created_date
,b.date_of_incident
,b.date_paid
,b.deleted_oltp_by
,b.deleted_oltp_date
,b.duplicate_bill
,b.ending_service_date
,b.event_case_id
,b.event_id
,b.from_oltp_by
,b.oltp_bill_status
,b.review_status
,b.Row_Effective_Date
from STAGE_FADM_HRI_STAGE_BILL b))
select
e.action_plan e_action_plan
,e.action_plan_status e_action_plan_status
,e.batch_id e_batch_id
,e.client_cause_code e_client_cause_code
,e.client_id e_client_id
,e.client_datafeed_code e_client_datafeed_code
,e.client_policy_identifier e_client_policy_identifier
,e.close_date e_close_date
,e.created_date e_created_date
,e.date_of_incident e_date_of_incident
,e.date_typed e_date_typed
,e.discovery_source e_discovery_source
,e.employer_group_id e_employer_group_id
,e.event_id e_event_id
,e.event_status_code e_event_status_code
,e.event_type_code e_event_type_code
,e.exclude_from_invoice e_exclude_from_invoice
,e.from_ncoa_date e_from_ncoa_date
,e.group_contract_funding_type e_group_contract_funding_type
,e.hmo_ppo_indemnity_type e_hmo_ppo_indemnity_type
,e.insurance_product_name e_insurance_product_name
,e.insured_termination_date e_insured_termination_date
,e.invoice_date e_invoice_date
,e.letter_status e_letter_status
,e.letter_status_date e_letter_status_date
,e.liability_analysis e_liability_analysis
,e.loss_city e_loss_city
,e.loss_description e_loss_description
,e.loss_state_code e_loss_state_code
,e.manually_moved e_manually_moved
,e.moved_by_user_id e_moved_by_user_id
,e.ncoa_code e_ncoa_code
,e.next_steps e_next_steps
,e.open_date e_open_date
,e.policy_holder_address1 e_policy_holder_address1
,e.policy_holder_address2 e_policy_holder_address2
,ec.action_plan
,ec.action_plan_status
,ec.batch_id
,ec.case_status_code
,ec.client_datafeed_code
,ec.client_id
,ec.client_party_identifier
,ec.close_date
,ec.created_date
,ec.damaged_party_address1
,ec.damaged_party_address2
,ec.damaged_party_city
,ec.damaged_party_dob
,ec.damaged_party_first_name
,ec.damaged_party_gender
,ec.damaged_party_last_name
,ec.damaged_party_ssn
,ec.damaged_party_state_code
,ec.damaged_party_zip
,ec.deductible
,ec.deductible_applied
,ec.deductible_recovered
,ec.deductible_recovered_full
,ec.event_case_id
,ec.event_id
,ec.fee_schedule_code
,ec.internal_coverage_code
,ec.litigation_flag
,ec.loss_injury_description
,ec.next_steps
,ec.open_date
,ec.payment_coverage_code
,ec.pursuit_level_code
,ec.reject_code
,ec.reject_comments
,ec.reject_date
,ec.reject_date
,ec.reject_user_id
,ec.setup_type
,ec.tot_paid_at_close
,eccf.Client_field_data eccf_client_fleld_data
,eccf.Client_field_name eccf_client_field_name
,eccf.Client_id eccf_client_id
,eccf.Event_case_id eccf_event_case_id
,ecf.client_field_data ecf_client_field_data
,ecf.client_field_name ecf_client_field_name
,ecf.client_id ecf_client_id
,ecf.event_id ecf_event_id
from
event@hri1_read_only_remote e,
event_case@hri1_read_only_remote ec,
event_case_client_field@hri1_read_only_remote eccf,
event_client_field@hri1_read_only_remote ecf,
stg_fadm_hri_stage_bill sb
where
e.event_id = ec.event_id and
e.event_id = ecf.event_id and
ec.event_case_id = eccf.event_case_id and
e.event_id = ecf.event_id and
e.client_id = ecf.client_id and
e.client_id = ec.client_id and
ec.client_id = ecf.client_id and
e.event_id = sb.event_id and
ec.event_case_id = sb.event_case_id and
eccf.event_case_id = sb.event_case_id and
ecf.event_id = sb.event_id;
end Load_FADM_Staging_Area_TEST;Just noticed
I tried querying the table and it returns no data.Could be your NOT EXISTS clause, you are missing something? - "Something" exists, unless the table is empty.
Should probably be something like:
AND NOT EXISTS (SELECT NULL -- You are actually not selecting anything, just probing for existence
WHERE <<Correlation to table "a">>Furthermore, you'll never manage to compile the procedure since your second select does not select INTO anything.
(A more apprpriate subject would be "Error while compiling a procedure".)
Finally, When would the ELSE be reached here?
if p_data_load_date IS NULL then
select (sysdate - 7), (sysdate - 1) into v_start_date, v_end_date from dual;
elsif p_data_load_date IS NOT NULL then
select (p_data_load_date - 7), (p_data_load_date - 1) into v_start_date, v_end_date from dual;
ELSE
raise_application_error('-20042', 'Data control - GetDataControlAuditData : Date parameter must be a date of this or a previous week.');
end if;Regards
Peter -
Error while executing PlSQL Procedure
Hi Chris,
Procedure SPR_VISAMAST_SWITCHCATEGORIZE is created in the TimesTen interchange user. and all object used by this procedure also cached in the TimesTen.
While executing it is giving error.
I traced out where execution is failing, i found that update query on cached table it is giving error.
Command> DECLARE
> SOUTPUT VARCHAR2(4000);
> BEGIN
> INTERCHANGE.SPR_VISAMAST_SWITCHCATEGORIZE('123456', 'SWTCH.030709', 'v2.01', 'fl.01' , 'v2.02' , '1' , SOUTPUT);
> END;
> /
5213: Bad Oracle login error in OCISessionBegin(): ORA-01017: invalid username/password; logon denied rc = -1
5131: Cannot connect to backend database: OracleNetServiceName = "geni11g", uid = "INTERCHANGE", pwd is hidden, TNS_ADMIN = "/u01/app/oracle/product/11.1.0/db_1/network/admin", ORACLE_HOME= "/u01/app/oracle/product/11.1.0/db_1"
8507: ORA-06512: at "INTERCHANGE.SPR_VISAMAST_SWITCHCATEGORIZE", line 39
8507: ORA-06512: at line 4
The command failed.
Please tell me how to solve this issue.So when you execute this procedure it is actually executing as user INTERCHANGE. Any objects that the procedure references whcih do not include an explicit owner will assume the object is owned by user INTERCHANGE and this may mean that an object cannot be found.
Here is an example...
Let's say you have a cached table in TimesTen and the table is owned by the user 'CACHEUSER' - CACHEUSER.MyCachedtable.
If you create a PL/SQL procedure owned by the user INTERCHANGE - INTERCHANGE.Someprocedure and within thie procedure include a statement like SELECT * FROM MyCachedtable then when the procedure is executed it will by default always look for the table INTERCHANGE.MyCachedTable even if the user executing the procedure is 'CACHEUSER'. As a result, it would not find the table MyCachedTable in TimesTen and, depending on the setting for PassThrough it might try and go to Oracle for this table.
Another possibility is that the PL/SQL procedure is performing some cache operation that requires interaction with the Oracle DB and you did not include 'OraclePWD=xxx' to provide the password for Oracle when you connected. Remember that the procedure will be executing, by default, as the user INTERCHANGE not as the user 'CACHEUSER'.
Chris -
Executing A Procedure In a Package Using DBLink
I need to execute a procedure which is residing in a package using dblink.
The package got a execute PUBLIC grant.
When I execute the following statement, I am getting error ORA: 00904, Invalid Identifier
select PKG_NAME.PROCEDURE_NAME@dblink(null,null,null,null,null,null,null,null,null,null,null) from dual
How can I execute the above statement.
Thanks in advanceI have a database INLABNEW in that i have done this
SQL> create table temp(no number)
2 /
Table created.
SQL> create or replace package pkg
2 as
3 procedure p;
4 end;
5 /
Package created.
SQL> create or replace package body pkg
2 as
3 procedure p
4 is
5 begin
6 insert into temp values(1);
7 end;
8 end;
9 /
Package body created.
SQL> select * from temp
2 /
no rows selectedNow i executed the procedure pkg.p from another database
SQL> exec pkg.p@to_inlabnew
PL/SQL procedure successfully completed.
SQL> commit
2 /And i query the table tmp in INLABNEW
SQL> select * from temp
2 /
NO
1Now question is have you given your procedure name properly.
as your procedure is in a package it should be Your_package_name.Your_procedure_name@Your_db_link -
Error while executing query through rsrt
hello experts,
I am facing following error while executing one HR query through rsrt.
"System error in program SAPLRRI2 and form REP_ASSIGN_INITIAL_OPT-01- (see long text) "
while executing query through rsrt it automatically goes to debug mode, coming out of debug mode i get the screan showing above error message.
What would be an issue?
Regards,
Nirav
Edited by: Nirav Shah on Apr 21, 2008 8:19 AMHi ramesh,
I havent kept any execlusion selection. Though i saw long text, it is like this:
"Diagnosis
This internal error is an intended termination resulting from a program state that is not permitted.
Procedure
Analyze the situation and inform SAP.
If the termination occurred when you executed a query or Web template, or during interaction in the planning modeler, and if you can reproduce this termination, record a trace (transaction RSTT).
For more information about recording a trace, see the documentation for the trace tool environment as well as SAP Note 899572.
Notification Number BRAIN 299 "
Regards,
Nirav -
SSIS package fails when it is executed by procedure (2008)
Hi there,
I have a very anoying problem with SSIS. I've done new packages into same project, almost identical compared to old ones. They work well in visual studio, but I can't execute them using procedure. Old packages works just fine, but none of the new. Error
message is in the end of my story.
Visual Studio version is 9.0.30729.1 and SQL Server version is 10.0.4000.0. Is it possible, that these not not updated versions could cause this problem?
Package ProtectionLevel is DonSaveSensitive.
Br,
Ville
Error messages, when package is executed by procedure:
Microsoft (R) SQL Server Execute Package Utility
Version 10.50.1600.1 for 64-bit
Copyright (C) Microsoft Corporation 2010. All rights reserved.
NULL
Started: 10:36:48 AM
Error: 2015-03-31 10:36:48.48
Code: 0xC0016016
Source:
Description: Failed to decrypt protected XML node
"DTS:Password" with error 0x8009000B "Key not valid for use in
specified state.". You may not be authorized to access this information.
This error occurs when there is a cryptographic error. Verify that
the correct key is available.
End Error
Progress: 2015-03-31 10:36:48.65
Source: Data Flow Task 1
Validating: 0% complete
End Progress
Progress: 2015-03-31 10:36:48.81
Source: Data Flow Task 1
Validating: 50% complete
End Progress
Progress: 2015-03-31 10:36:48.81
Source: Data Flow Task 1
Validating: 100% complete
End Progress
Progress: 2015-03-31 10:36:48.82
Source: Data Flow Task 1
Validating: 0% complete
End Progress
Progress: 2015-03-31 10:36:48.88
Source: Data Flow Task 1
Validating: 50% complete
End Progress
Progress: 2015-03-31 10:36:48.89
Source: Data Flow Task 1
Validating: 100% complete
End Progress
Progress: 2015-03-31 10:36:48.89
Source: Data Flow Task 1
Prepare for Execute: 0% complete
End Progress
Progress: 2015-03-31 10:36:48.89
Source: Data Flow Task 1
Prepare for Execute: 50% complete
End Progress
Progress: 2015-03-31 10:36:48.89
Source: Data Flow Task 1
Prepare for Execute: 100% complete
End Progress
Progress: 2015-03-31 10:36:48.95
Source: Data Flow Task 1
Pre-Execute: 0% complete
End Progress
Progress: 2015-03-31 10:36:49.03
Source: Data Flow Task 1
Pre-Execute: 50% complete
End Progress
Warning: 2015-03-31 10:36:49.03
Code: 0x80070003
Source: Data Flow Task 1 Destination - tb_month_standard_idx_table_exp_032013-082013_20140307_csv
[34]
Description: The system cannot find the path specified.
End Warning
Progress: 2015-03-31 10:36:49.28
Source: Error Msg
Executing query "insert into
focusbase.dbo.tb_ctrl_package_error_ms...".: 100% complete
End Progress
Error: 2015-03-31 10:36:49.28
Code: 0xC020200E
Source: Data Flow Task 1 Destination -
tb_month_standard_idx_table_exp_032013-082013_20140307_csv [34]
Description: Cannot open the datafile
"D:\Procogs_export_validation\StandardSetup\tb_month_standard_idx_table_exp_032013-082013_20140307.csv".
End Error
Progress: 2015-03-31 10:36:49.29
Source: Error Msg
Executing query "insert into
focusbase.dbo.tb_ctrl_package_error_ms...".: 100% complete
End Progress
Error: 2015-03-31 10:36:49.29
Code: 0xC004701A
Source: Data Flow Task 1 SSIS.Pipeline
Description: component "Destination -
tb_month_standard_idx_table_exp_032013-082013_20140307_csv" (34) failed
the pre-execute phase and returned error code 0xC020200E.
End Error
Progress: 2015-03-31 10:36:49.29
Source: Data Flow Task 1
Pre-Execute: 100% complete
End Progress
Progress: 2015-03-31 10:36:49.29
Source: Data Flow Task 1
Post Execute: 0% complete
End Progress
Progress: 2015-03-31 10:36:49.29
Source: Data Flow Task 1
Post Execute: 50% complete
End Progress
Progress: 2015-03-31 10:36:49.29
Source: Data Flow Task 1
Cleanup: 0% complete
End Progress
Progress: 2015-03-31 10:36:49.29
Source: Data Flow Task 1
Cleanup: 50% complete
End Progress
Progress: 2015-03-31 10:36:49.29
Source: Data Flow Task 1
Cleanup: 100% complete
End Progress
DTExec: The package execution returned DTSER_FAILURE (1).
Started: 10:36:48 AM
Finished: 10:36:49 AM
Elapsed: 0.905 seconds
NULL<o:p></o:p>
<o:p> </o:p>
<o:p> </o:p>Hi,
That path is not in use?! Yes, it is in error, but not in package. Maybe it has been there before, but now I can't find it. Or actually, path is valid, but not the file name.
I had on error in package configuration file path, but here is the latest error message:
Br,
Ville
Microsoft (R) SQL Server Execute Package Utility
Version 10.50.1600.1 for 64-bit
Copyright (C) Microsoft Corporation 2010. All rights reserved.
NULL
Started: 1:50:59 PM
Error: 2015-03-31 13:50:59.38
Code: 0xC0016016
Source:
Description: Failed to decrypt protected XML node
"DTS:Password" with error 0x8009000B "Key not valid for use in
specified state.". You may not be authorized to access this information.
This error occurs when there is a cryptographic error. Verify that
the correct key is available.
End Error
Progress: 2015-03-31 13:50:59.56
Source: Data Flow Task 1
Validating: 0% complete
End Progress
Progress: 2015-03-31 13:50:59.72
Source: Data Flow Task 1
Validating: 50% complete
End Progress
Progress: 2015-03-31 13:50:59.72
Source: Data Flow Task 1
Validating: 100% complete
End Progress
Progress: 2015-03-31 13:50:59.73
Source: Data Flow Task 1
Validating: 0% complete
End Progress
Progress: 2015-03-31 13:50:59.79
Source: Data Flow Task 1
Validating: 50% complete
End Progress
Progress: 2015-03-31 13:50:59.79
Source: Data Flow Task 1
Validating: 100% complete
End Progress
Progress: 2015-03-31 13:50:59.79
Source: Data Flow Task 1
Prepare for Execute: 0% complete
End Progress
Progress: 2015-03-31 13:50:59.79
Source: Data Flow Task 1
Prepare for Execute: 50% complete
End Progress
Progress: 2015-03-31 13:50:59.79
Source: Data Flow Task 1
Prepare for Execute: 100% complete
End Progress
Progress: 2015-03-31 13:50:59.86
Source: Data Flow Task 1
Pre-Execute: 0% complete
End Progress
Progress: 2015-03-31 13:50:59.92
Source: Data Flow Task 1
Pre-Execute: 50% complete
End Progress
Warning: 2015-03-31 13:50:59.92
Code: 0x80070003
Source: Data Flow Task 1 Destination -
tb_month_standard_idx_table_exp_032013-082013_20140307_csv [34]
Description: The system cannot find the path specified.
End Warning
Progress: 2015-03-31 13:51:00.17
Source: Error Msg
Executing query "insert into
focusbase.dbo.tb_ctrl_package_error_ms...".: 100% complete
End Progress
Error: 2015-03-31 13:51:00.17
Code: 0xC020200E
Source: Data Flow Task 1 Destination -
tb_month_standard_idx_table_exp_032013-082013_20140307_csv [34]
Description: Cannot open the datafile
"D:\Procogs_export_validation\StandardSetup\tb_month_standard_idx_table_exp_032013-082013_20140307.csv".
End Error
Progress: 2015-03-31 13:51:00.17
Source: Error Msg
Executing query "insert into
focusbase.dbo.tb_ctrl_package_error_ms...".: 100% complete
End Progress
Error: 2015-03-31 13:51:00.17
Code: 0xC004701A
Source: Data Flow Task 1 SSIS.Pipeline
Description: component "Destination -
tb_month_standard_idx_table_exp_032013-082013_20140307_csv" (34) failed
the pre-execute phase and returned error code 0xC020200E.
End Error
Progress: 2015-03-31 13:51:00.17
Source: Data Flow Task 1
Pre-Execute: 100% complete
End Progress
Progress: 2015-03-31 13:51:00.17
Source: Data Flow Task 1
Post Execute: 0% complete
End Progress
Progress: 2015-03-31 13:51:00.17
Source: Data Flow Task 1
Post Execute: 50% complete
End Progress
Progress: 2015-03-31 13:51:00.17
Source: Data Flow Task 1
Cleanup: 0% complete
End Progress
Progress: 2015-03-31 13:51:00.17
Source: Data Flow Task 1
Cleanup: 50% complete
End Progress
Progress: 2015-03-31 13:51:00.17
Source: Data Flow Task 1
Cleanup: 100% complete
End Progress
DTExec: The package execution returned DTSER_FAILURE (1).
Started: 1:50:59 PM
Finished: 1:51:00 PM
Elapsed: 0.858 seconds
NULL<o:p></o:p> -
Execute query when post text item
Anybody can help ?
I create 2 block, first a data block and another is a control block with field customer_search field,
after inputing customer id in search field on control block,
I want to execute query.
my code :
set_block_property('customer',default_where,'custid=:control.customer_search');
execute_query;
error : frm-407 : illegal restricted procedure execute_query in post-text-item trigger.
How to solve this problem ?
notes: If I create one push button and put execute_query in there, every thing is fine.
but the my user does not like that.
Thank.hi,
first of all change ur statement as
set_block_property('customer',default_where,'custid='||:control.customer_search);
means u must use pipe sign while using bind variable
secondly
u should use key next item trigger
go_block(user desired item or block);
--and then use this satemant
clear_block(no_validate);
execute_query(no_validate);
i hope it wil slove ur peoblem if it will NOT then please acknowledge otherwise we will go for a other solution
thanks
imran
manager IT
www.masoodtextile.com -
Which user/schema executed query in V$SQLAREA
I am looking on one row/query in view "V$SQLAREA" and want to which user/schema was used to log in to the database when that one query was executed. How i can get that schema name?
Should i look this column maybe:
V$SQLAREA
PARSING_SCHEMA_NAME VARCHAR2(30) Schema name that was used to parse this child cursor( http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_2129.htm )
I have Java software that uses different database schemas/users to make connections to my database. And i want to know for one query which schema/user was used to connect to database before running the query.
I think i need to join "V$SQLAREA" to view V$SESSION and there the column "USERNAME" tells me the connection user name for the executed query.
V$SESSION
USERNAME VARCHAR2(30) Oracle username
( http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_2088.htm )Seems like i fail to join "V$SQLAREA" to view V$SESSION:
select q.SQL_TEXT, q.sql_id, q.PARSING_SCHEMA_NAME, q.ADDRESS, q.last_active_time, s.USERNAME, s.SCHEMANAME from v$sqlarea q, v$session s
where q.last_active_time > sysdate - 1
and q.sql_text like 'DELETE FROM casino.lgngameoperationlog WHERE sessionCode%'
and s.sql_address=q.address
order by last_active_time desc
no rows found
select q.SQL_TEXT, q.sql_id, q.PARSING_SCHEMA_NAME, q.ADDRESS, q.last_active_time from v$sqlarea q
where q.last_active_time > sysdate - 1
and q.sql_text like 'DELETE FROM casino.lgngameoperationlog WHERE sessionCode%'
order by last_active_time desc
'DELETE FROM casino.lgngameoperationlog WHERE sessionCode = :1 and sessionType = :2'; 51thfgbubkkg6; JAVA; 0000000392523658; 28.10.2010 18:09:14;
*/I have Java software that uses different database schemas/users to make connections to my database. And i want to know for one query which schema/user was used to connect to database before running the query.If the SQL-text sits inside your Java code, that is the text does not sit inside some stored pl/sql program unit, then you can use parsing_schema_id, yes.
If the SQL-text sits inside a stored procedure, then depending on how that procedure is defined (invoker rights or definer rights), you could use parsing_schema_id too (in the first case (invoker rights)). -
Executing Stored Procedure within Excel
I am in the middle of setting up an Excel spreadsheet that will execute a stored procedure I have created and return the results to Excel. Pretty much following the example set here:
http://datapigtechnologies.com/blog/index.php/running-a-sql-stored-procedure-from-excel-with-dynamic-parameters/
But, the problem I am stuck on and unable to yet find an answer to, is can I execute the procedure from within Excel and instead of specifying a parameter enter a WHERE clause. At the moment the last step of my stored procedure is:
SELECT * FROM MY_TABLE
WHERE ([PRODUCT] LIKE 'DESK-%') AND (NOT([DISCOUNT VALUE] IS NULL))
But, I cannot find if it is possible to execute this from within Excel. I am not sure if it I am able to set the WHERE as a parameter which may be the way I should be going about this.
Thanks.Are you invoking a stored procedure, or are you sending a SELECT statement (ad-hoc query) to the SQL Server? It seems like you are sending an ad-hoc query.
If that is the case, I would not put the entire WHERE clause as a parameter. I would do it something like this:
"SELECT * FROM MY_TABLE WHERE ([PRODUCT] LIKE '" & Range("B2").Value & "%') AND (NOT([DISCOUNT VALUE] IS NULL))"
That assumes that the parameter that you want to use is in cell B2.
Ideally, I would prefer not to use ad-hoc queries. Instead, create a stored procedure which takes the Product type as a parameter. There are lots of examples on the net on how to query SQL Server from Excel via a stored procedure with parameters. -
How to Execute Remote procedures that use DBLinks?
Using Oracle 10g (RAC Linux) to remote connect Windows 10g to dblink to AS/400 <
<I have created a procedure that I execute remotely by issuing the following:
CALL GLOBAL.REFRESH_STAGING@KRONOSLINK();
The procedure errors as
Error at line 2
ORA-20001: ERROR OCCURED
ORA-06512: at "GLOBAL.REFRESH_STAGING", line 47
ORA-06512: at line 1
The procedure runs without error from the host database. The problem is when the procedure makes a call to the dblink.
I unsuccessfully attempted to capture the error message.
Question: Is it possible to execute remote procedures that use dblinks? If so, How is that accomplished.
Question: What is the proper way to handle exceptions in this case?
Bonus: What can be done to improve this procedure? (Suggestions, like adding return on the procedure).
CREATE OR REPLACE PROCEDURE GLOBAL.REFRESH_STAGING IS
NOOBJECT EXCEPTION;
OBJECTEXIST EXCEPTION;
PRAGMA EXCEPTION_INIT(NOOBJECT, -00942); -- Exception handling for ORA-00942 - table or view does not exist
PRAGMA EXCEPTION_INIT(OBJECTEXIST, -00955); -- Exception handling for ORA-009555 - name is already used by an existing object
sT LONG := '';
sS LONG := '';
sST LONG := '';
cursor csrO is
SELECT
SCHEMANAME,
TABLENAME
FROM GLOBAL.STAGING_TABLES;
csrR csrO%ROWTYPE;
BEGIN
FOR csrR IN csrO
LOOP
sT := csrR.TABLENAME;
sS := csrR.SCHEMANAME;
sST := sS || '.' || sT;
BEGIN
EXECUTE IMMEDIATE 'drop table global.' || sT || ' purge';
EXCEPTION
WHEN NOOBJECT THEN
NULL;
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_CALL_STACK);
DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_ERROR_STACK);
RAISE_APPLICATION_ERROR (-20001, 'ERROR OCCURED');
END;
BEGIN
EXECUTE IMMEDIATE 'create table global.' || sT || ' nologging as select * from ' || sST || '@thebosslink';
COMMIT;
EXCEPTION
WHEN OBJECTEXIST THEN
NULL;
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_CALL_STACK);
DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_ERROR_STACK);
DBMS_OUTPUT.PUT_LINE(SQLCODE || ' - ' || SQLERRM);
RAISE_APPLICATION_ERROR (-20001, 'ERROR OCCURED');
END;
END LOOP;
END REFRESH_STAGING;
Thanks,
blevelsSET LINESIZE 500;
COLUMN DB_LINK FORMAT a20
COLUMN HOST FORMAT a20
COLUMN USERNAME FORMAT a20
COLUMN OWNER FORMAT a10
COLUMN TABLE_NAME FORMAT a20
select db_link,username, host from all_db_links where db_link = 'KRONOSLINK';
select privilege from dba_sys_privs where grantee = 'SYSTEM';
select owner, table_name from dba_tab_privs where grantee='SYSTEM';
DBLINK_ USERNAME HOST
KRONOSLINK SYSTEM ORCL
1 row selected.
PRIVILEGE
GLOBAL QUERY REWRITE
CREATE MATERIALIZED VIEW
CREATE TABLE
UNLIMITED TABLESPACE
SELECT ANY TABLE
5 rows selected.
OWNER TABLENAME_
SYS INCEXP
SYS INCEXP
SYS INCEXP
SYS INCEXP
SYS INCEXP
SYS INCEXP
SYS INCEXP
SYS INCEXP
SYS INCEXP
SYS INCEXP
SYS INCEXP
SYS INCVID
SYS INCVID
SYS INCVID
SYS INCVID
SYS INCVID
SYS INCVID
SYS INCVID
SYS INCVID
SYS INCVID
SYS INCVID
SYS INCVID
SYS INCFIL
SYS INCFIL
SYS INCFIL
SYS INCFIL
SYS INCFIL
SYS INCFIL
SYS INCFIL
SYS INCFIL
SYS INCFIL
SYS INCFIL
SYS INCFIL
SYS DBMS_ALERT
SYS DBMS_SYS_ERROR
SYS DBMS_RULE_EXIMP
SYS DBMS_AQ
SYS DBMS_AQADM
SYS DBMS_AQ_IMPORT_INTER
NAL
SYS DBMS_AQELM
SYS DBMS_TRANSFORM_EXIMP
SYS SYS_GROUP
SYS DBMS_DEFER_IMPORT_IN
TERNAL
SYS DBMS_REPCAT
WMSYS WM$UDTRIG_INFO
SYS SET_TABLESPACE
SYS CHECK_UPGRADE
SYS AVINASH
SYS AVINASH
SYS AVINASH1
SYS AVINASH1
SYS DB_PMP
SYS DB_PMP
SYS DIR_TESTCASE
SYS DIR_TESTCASE
SYS EXPORT_FULL_DIR
SYS EXPORT_FULL_DIR
SYS PUMP
SYS PUMP
SYS LOGS
SYS LOGS
SYS DPUMP_DIR2
SYS DPUMP_DIR2
SYS AVIS
SYS AVIS
SYS DPDIR_LCLLGS
SYS DPDIR_LCLLGS
67 rows selected.
Edited by: user10860953 on Jan 28, 2010 10:43 AM -
I cannot execute an procedure in Java that is a "select ... for update" stt
I have a table with a column that has BLOB types. First I insert into that table with EMPTY_BLOB(). After I create a procedure as:
PROCEDURE file_content_select
p_id IN NUMBER,
p_file_content OUT BLOB
IS
BEGIN
SELECT f.file_content
INTO p_file_content
FROM files f
WHERE f.id = p_id
FOR UPDATE of f.file_content;
END; In my java program. I do that:
my query string:
query = ""
+ "BEGIN FILE_CONTENT_SELECT ("
+ id
+ ",?); END;";and my execute query code:
callableStatement = connection.prepareCall(query);
callableStatement.registerOutParameter(1, OracleTypes.BLOB);
callableStatement.execute();
dataBlob = (BLOB) callableStatement.getObject(1);But, I seem to stop at
callableStatement.execute();where I'm wrong? Thanks for help me.When you say, "locked" was already deselected, I take it that you mean the small icon at the bottom right of the Get Info window displayed an open lock picture.
Have you tried locking it, then unlocking it again? I expect you will be able to lock it by simply clicking on the open lock icon, but to unlock it again you will need to supply an Admin password.
Odd that DU didn't fix it. That would be my first thought also. Suggest trying it again, if you haven't already done so.
Speaking of DU, have you verified your HDD?
My Applications folder permissions read -
System Read and Write
admin Read and Write
everyone Read only
Message was edited by: El Deanio -
Dynamic Sql no execute inside procedure
Hi
There are a new table, I give permission for select, update, inser and delete, when I executed query select work fine, but when This query is executed inside procedure with dynamic sql return error: ORA-01031 Insufficient Prvileges
I try to test out procedure and work fine , see below
declare
CCURSOR SYS_REFCURSOR;
RCURSOR TRITON.TTDSLS992901%ROWTYPE;
V_SQL VARCHAR2(2000);
begin
V_SQL :='SELECT * FROM TRITON.TTDSLS992'|| '901' || CHR(10);
V_SQL := V_SQL || ' WHERE T$CONO$O = 410705'|| CHR(10);
V_SQL := V_SQL || ' AND T$PONO$O = 10'|| CHR(10);
V_SQL := V_SQL || ' AND T$COND$O = 0'|| CHR(10);
V_SQL := V_SQL ||'AND T$ETPA$O = 1 '|| CHR(10);
V_SQL := V_SQL || ' AND ROWNUM = 1'|| CHR(10);
V_SQL := V_SQL || ' ORDER BY T$CONO$O, T$PONO$O, T$COND$O DESC';
OPEN CCURSOR FOR V_SQL;
FETCH CCURSOR INTO RCURSOR;
IF CCURSOR%FOUND THEN
NULL;
ELSE
NULL;
END IF;
CLOSE CCURSOR;
end;the Code 901 is not constant, change when Company change
Why return error permission inside procedure ?Hardcode the value to '901' & check TRITON.TTDSLS992901 has execute permission to schema where you want to call this
TRITON.TTDSLS992'|| '901' ~Lokanath -
hi
create or replace procedure spSelgl(brcode varchar2, p_return_cur OUT SYS_REFCURSOR ) is
begin
open p_return_cur for select * from mytable
where col1=brcode;
end spSelgl;
how can I execute this query in sql plus ?
Regards
JoshHi,
Try this to execute your procedure :-
declare
v_brcode varchar2(20);
v_p_return_cur SYS_REFCURSOR;
begin
spSelgl(
brcode => v_brcode,
p_return_cur =>v_p_return_cur
end;
Thanks
Pavan Kumar N
Maybe you are looking for
-
My apple id account is using an email to send me messages that im not familiar with
Hello, Im having difficulty with my security questions I can not remember the answers to them. The email for the request of the amswers is not my email address so I am not able to use my apple ID account. How can you help me.
-
Blocking Goods Receipt for more than one PO
Dear All, We have a requirement. We do not want to do goods receipt for more than one PO.STD SAP is allowing us to do the same. Can we block it ? We want one One Material Doc for One PO .For One PO there can be more than one material docume
-
I have the new iPod Touch but I'm having trouble syncing videos to my PC.
I got the iPod Touch 5. I recorded some videos and plugged my iTouch into my PC. When I try to download it, it let's me, but it can't play it. It is making me so mad. I tried on my laptop but it did the same thing. It apparently needs to know what I
-
All the SQL functions - to use in Discoverer-desktop reporting?
Hi , Can anyone tell me where i can find all the SQL functions, <conditional stmts> etc - to use in Discoverer-desktop reporting?. Thx, Sree
-
Hi Guys, Ive built a system which uses 8/9 servlets and connects to a postgres database, reads csv files and a few other things, now Ive been asked to implement this using java enterprise beans, how easy/difficult is this? how would I go about it and