Cannot export the ORDDataSource object with an external source - sql

I'm trying create a procedure like this:
CREATE OR REPLACE PROCEDURE export_dicom (identyfikator_wyniku number, new_file_name varchar2)
AS
obr ORDDicom;
BEGIN
SELECT dicom_zrodlo INTO obr FROM wyniki WHERE id_wyniku = identyfikator_wyniku;
obr.export('FILE', 'MEDIA_FILES', new_file_name);
END;
But when I create it and use it, I get an error like this:
ORA-53216: cannot export the ORDDataSource object with an external source
ORA-06512: at "ORDSYS.ORDERROR", line 5
ORA-06512: at "ORDSYS.ORDDATASOURCE", line 265
ORA-06512: at "ORDSYS.ORDDICOM", line 234
ORA-06512: at "ZAD2.export_dicom", line 6
ORA-06512: at line 1
Anyone know how to fix it?

Related

ORA-00904 Trying to merge two tables

Trying to merge 2 tables. Having issues merging them
If NAME_CINTAS_ column from Locker_audit table is the same as NAME from Locker_Term_List Table, I want the column 'Term_Employee' to update to a value of 'yes' in the Locker Audit table
merge into locker_audit a
using locker_term_list b
on (a.name_cintas_ = b.name)
when matched then update set
a.term_employee = 'yes';
I receive this error
[![enter image description here][1]][1]
Error at line 3/13: ORA-00904: "A"."NAME_CINTAS_": invalid identifier
ORA-06512: at "SYS.WWV_DBMS_SQL_APEX_220100", line 847
ORA-06512: at "SYS.DBMS_SYS_SQL", line 1658
ORA-06512: at "SYS.WWV_DBMS_SQL_APEX_220100", line 833
ORA-06512: at "APEX_220100.WWV_FLOW_DYNAMIC_EXEC", line 1903
1. merge into locker_audit a
2. using locker_term_list b
3. on (a.name_cintas_ = b.name)
4. when matched then update set
5. a.term_employee = 'yes';
if I try adding the word as I get a different error:
merge into locker_audit as a
using locker_term_list as b
on (a.name_cintas_ = b.name)
when matched then update set
a.term_employee = 'yes';

How do I get the size of a file(BFILE) in oracle g11 directly from a directory in my pc?

I was trying to get the size of a file from my desktop in Oracle SQL Developer, I'm working with a "BFILE" field.
And this is the query that I'm using
SET SERVEROUTPUT ON
DECLARE
v_bfile BFILE;
begin
select valor into v_bfile from TABLA_BFILE where id = 4;
DBMS_OUTPUT.PUT_LINE('El archivo ocupa: '||DBMS_LOB.GETLENGTH(v_bfile)||' bytes.');
end;
And I'm getting the next error
ORA-06512: en "SYS.DBMS_LOB", línea 787
ORA-06512: en línea 5
22285. 00000 - "non-existent directory or file for %s operation"
What I'm missing here?
Your code works fine.
The issue was with the population of the table.
The directory should not be a path but a DIRECTORY object.
create directory DESKTOP as 'C:\Users\Roberto\Desktop';
Insert into TABLA_BFILE (ID,valor) values (1,BFILENAME('DESKTOP','oracle.jpg'));

ORA-22288: file or LOB operation FILEOPEN failed

I have xml file abc.xml in \\192.168.1.71\err_log
I did below steps and getting error:
create directory XMLDIR2 as '\\192.168.1.71\err_log';
GRANT ALL ON DIRECTORY xmldir2 TO PUBLIC;
INSERT INTO example2
VALUES ( xmltype (
bfilename('XMLDIR2', 'abc.xml'),
nls_charset_id('AL32UTF8')
)
);
Getting below error:
ERROR at line 4: ORA-22288: file or LOB operation FILEOPEN failed
ORA-06512: at "SYS.XMLTYPE", line 296 ORA-06512: at line 1

Character string buffer too small error in Oracle Stored Procedure

I am getting an error in an Oracle 11g stored procedure. The error is...
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
It is happening at line 31, the line that contains out_cnt_tot := 0; I'm really not sure why there is anything wrong with that line. Another programmer created this procedure and I'm really not familiar with SQL procedures. Can anyone help me figure this out?
create or replace
PROCEDURE "FIP_BANKREC_PREP"
(
in_file_date in varchar2,
in_bank_code in varchar2,
out_cnt_apx_miss_no out integer,
out_cnt_prx_miss_no out integer,
out_cnt_apx_no_mtch out integer,
out_cnt_prx_no_mtch out integer,
out_cnt_ap_dup out integer,
out_cnt_pr_dup out integer,
out_cnt_bad out integer,
out_cnt_ap_load out integer,
out_cnt_pr_load out integer,
out_cnt_ap_not_load out integer,
out_cnt_pr_not_load out integer,
out_cnt_tot out integer,
out_message out varchar2
) as
file_date date;
ap_acct_no varchar2(16);
pr_acct_no varchar2(16);
-- ------------------------------------------------------
-- begin logic
-- ------------------------------------------------------
begin
file_date := to_date(in_file_date,'yyyymmdd');
out_cnt_tot := 0; --- THE ERROR IS ON THIS LINE ---
out_message := 'Test Message';
select brec_acct_code into ap_acct_no
from MSSU.zwkfi_bankrec_accts
where brec_acct_bank = in_bank_code
and brec_acct_type = 'AP';
select brec_acct_code into pr_acct_no
from MSSU.zwkfi_bankrec_accts
where brec_acct_bank = in_bank_code
and brec_acct_type = 'PR';
// The rest of the procedure...
Simple demo of the scenario mentioned in comments:
create or replace procedure p42(out_message out varchar2) as
begin
out_message := 'Test message';
end p42;
/
If I call that with a variable that is declared big enough, it's fine. I have a 12-char variable, so assigning a 12-char value is not a problem:
declare
msg varchar2(12);
begin
p42(msg);
end;
/
anonymous block completed
But if I make a mistake and make the caller's variable too small I get the error you're seeing:
declare
msg varchar2(10);
begin
p42(msg);
end;
/
Error report:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "STACKOVERFLOW.P42", line 3
ORA-06512: at line 4
06502. 00000 - "PL/SQL: numeric or value error%s"
*Cause:
*Action:
The error stack shows both the line in the procedure that errored (line 3), and the line in the caller that triggered it (line 4). Depending on where you're calling it you might not have the whole stack, of course.
You mentioned that there would be various error messagesin the future. You need to make sure that anything that ever calls this defines the variables to be big enough to cope with any of your messages. If they were stored in a table you could semi-automate that, otherwise it'll be a manual code review check.
OK, saw your c# comment after posting this. It looks like you're calling this constructor; that doesn't say what default size it gets, but not unreasonable to think it might be 1. So you need to call this constructor instead to specify the size explicitly:
OracleParameter(String, OracleType, Int32)
Initializes a new instance of the OracleParameter class that uses the parameter name,
data type, and length.
... something like:
OracleParameter prm15 = new OracleParameter("out_str_message",
OracleDbType.Varchar2, 80);
Unless there's a way to reset the size after creation, which I can't see. (Not something I've ever used!).

I see the error but the account is valid

SQL> CREATE or REPLACE FUNCTION custord (custNo IN number)
2 RETURN NUMBER
3 IS cust_tot NUMBER(11,2);
4 BEGIN
5 SELECT sum(cust_total_field)
6 INTO cust_tot
7 FROM ord
8 WHERE cust_number_field=custNo;
9 RETURN(cust_tot);
10 END;
11 /
Warning: Function created with compilation errors.
SQL> begin
2 dbms_output.put_line('customer 102 total is ' || custord(102));
3 end;
4 /
dbms_output.put_line('customer 102 total is ' || custord(102));
*
ERROR at line 2:
ORA-06550: line 2, column 52:
PLS-00905: object CIS605.CUSTORD is invalid
ORA-06550: line 2, column 3:
PL/SQL: Statement ignored
SQL>
I see the error but object cis605 is valid. Any ideas what I am missing?
Using the ORD table create a stored function called custord that will use a customer id (CUSTID) that will return the sum of the specified customer id TOTAL field.
When your function has been stored run the following SQL:
begin
dbms_output.put_line('customer 102 total is ' || custord(102));
end;
Your output should look like:
Results
Explain
Describe
Saved SQL
History
customer 102 total is 27775.5
Statement processed.
Try
SHOW ERRORS FUNCTION custord
Your custord function was created with compilation errors, so there is something wrong with it. This is why you're getting the object CIS605.CUSTORD is invalid error.