Rowtype
I am trying to select the xml statement i am getting the below error.
ORA-06550: line 2, column 16:
PLS-00310: with %ROWTYPE attribute, 'TEST_TEMP.BU_CODE' must name a table, cursor or cursor-variable
ORA-06550: line 2, column 16:
PL/SQL: Item ignoreddeclare
l_bu_code test_temp.bu_code%rowtype;
l_result clob;
begin
select xmlelement("tendermanagement",
xmlattributes(
'http://www.ikea.com/sarec/declaredfunds' as "xmlns"
, 'http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi"
, 'http://www.prod.com/S_Dest/declaredfunds declaredFunds.xsd' as "xsi:schemaLocation"
, bu_type as "buType"
, bu_code as "buCode"
, 'RIMS' as "sourceSystem"
, xmlagg(
xmlelement("tendermovement",
xmlattributes(to_char(to_date(sales_date), 'YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "date"
,'DROP' as "bookingType"
, 'B2B Invoice' as "tenderType"
, 'STORE' as "salesAreaGroup"
,invoice_total as "valueTendered"
, till_no as "tillNo"
, receipt_no as "transactionNo"
).extract('/*').getclobval() as cutomer_info
into l_result
FROM test_temp
WHERE ROWNUM <20
group by bu_code,bu_type;
dbms_output.put_line(l_result);
end;
#1: This question has nothing to do with the XML DB and is a {forum:id=75} forum type question.
#2: You've seen the answer already in {message:id=11004918}. You used [url http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/rowtype_attribute.htm#LNPLS01342]%ROWTYPE when you really needed to use [url http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/type_attribute.htm#i36397]%TYPE. There is a difference. Follow those links to read about what those differences are.
Similar Messages
-
Error when fetching into a variable of ROWTYPE
I came across with a vied error when creating the body of a method.
Problem:
I have a Type called Emp_typ and a corresponding table Emp_tab.
When I create the body of get method it gives the following error msg :
Compilation errors for PACKAGE BODY CHAMITH.EMP_API
Error: PLS-00386: type mismatch found at 'EMP_ROW' between FETCH cursor and INTO variables
Line: 9
Text: fetch get_emp_rec into emp_row;
Get Method body :
function get(id_ number) return emp_tab%rowtype IS
cursor get_emp_rec IS
select * from emp_tab;
emp_row emp_tab%rowtype;
begin
open get_emp_rec;
fetch get_emp_rec into emp_row;
close get_emp_rec;
return emp_row;
end;
However when I do the same without having a type upon the table emp_tab, it works fine.
Pls give me a solution for that.
Thanks,
ChamithHi,
Let me know the Oracle Database Version.
Regards,
Sailaja -
How can I execute a Procedure with OUT variable is %ROWTYPE on SQL Prompt
Hi,
I have a procedure with OUT variable is %ROWTYPE
How can I execute the following procedure on SQL prompt.
(without creating anonymous block)
CREATE OR REPLACE PROCEDURE zz_sp_EMP(VEMPNO IN EMP.EMPNO%TYPE,
V_REC IN OUT EMP%ROWTYPE)
AS
BEGIN
SELECT * INTO V_REC FROM EMP WHERE EMPNO = VEMPNO;
END;
Thanks & Regards,
Nareshas previous posters said: it's not possible to do this without declaring a variable in the anonymous block.
With anonymous block it would look like this (had to change it a bit, since i'm using hr-schema on oracle XE):
declare
l_rec EMPLOYEES%ROWTYPE;
begin
zz_sp_EMP(VEMPNO => 100, V_REC => l_rec);
DBMS_OUTPUT.PUT_LINE ( 'first_name = ' || l_rec.first_name );
DBMS_OUTPUT.PUT_LINE ( 'last_name = ' || l_rec.last_name );
end;
first_name = Steven
last_name = King -
How to fetch %ROWTYPE OUT param of a stored procedure from Java program?
I have a stored procedure that has IN / OUT parameter as table_name%ROWTYPE.
From a java program how can I access this ROWTYPE variable?
I tried all possible documentation and none of the explains whether or not this is supported.
My use case expect exactly 1 record from the procedure and we would prefer not to use REF CURSOR.
Is there a way to achieve this? If so, can someone help me with it by posting the sample code to achieve this?
I tried all the possible OracleTypes to register the OutParameter and they all fail.
Looks like there isn't any equivalent of %ROWTYPE in OracleTypes either.
If you need, I can post my sample procedure that uses %ROWTYPE as OUT parameter.
I really appreciate your help in this regard.
- KarthikHi,
If "returning only 1 record" the showstopper for not using Ref Cursor, you might want to reconsider because as you probably know, the ref cursor is only a pointer and requires additional step to retrieve the data.
Kuassi -
In Oracle Database 9.0.1.3.0.
I compile a package, i have this Error:
57/5 PL/SQL: SQL Statement ignored
58/12 PL/SQL: ORA-00906: missing left parenthesisThis line:
INSERT INTO INFOWEB.GECOM_TACO
VALUES rTaco_;Where rTaco_ is INFOWEB.GECOM_TACO%ROWTYPE.
If change this insert...
INSERT INTO INFOWEB.GECOM_TACO (column1,column2,...)
VALUES (rTaco_.column1,rTaco_.column2,...);Then this package don't error.
Same package in Oracle Database 9.2.0.6.0, i haven't error.
it's a problem with this version of Database?Yes i think it was introduced only from 9.2. 9.0.1 does not talks about that.
You can refer the doc of 9.2
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/05_colls.htm#34340
Thanks,
karthick. -
ORA 04067 %rowtype and "PUBLIC". does not exist
Hi I have an error ORA-04067 for %rowtype in oracle 10g while running a form in turn it is calling a package. But the same thing is running fine with oracle 8i.
Is there any code changes we need to made to upgrade to oracle 10g. Is that not backward compatable to cursors. procedure is using rowtype variables.
can any one tell me the problem while migrating to oracle 10g from oracle 6i.
Basically I am getting two errors I am not sure whether these two are realted or not.
The error is Error code - 4067 and the Error - ORA 04067: not executed, Stored procedure "PUBLIC". does not exist.
We have applied a patch to solve "PUBLIC" issue but form is still not working.
procedure GetInventory
(p_inventory_rec in out INVENTORY%ROWTYPE,
p_lock BOOLEAN,
p_found out boolean,
p_locked out boolean) is
I will really appreciate your help.
Thanks
SandyPerhaps this link can give you some basic idea - i guess ->
db function throws ORA-04067 Procedure does not exist error in forms
Regards.
Satyaki De. -
SOLVED: How can I use or call a function that returns %ROWTYPE?
Hi
edit: you can probably skip all this guff and go straight to the bottom...In the end this is probably just a question of how to use a function that returns a %rowtype. Thanks.
Currently reading Feuerstein's tome, 5th ed. I've downloaded and run the file genaa.sp, which is a code generator. Specifically, you feed it a table name and it generates code (package header and package body) that will create a cache of the specified table's contents.
So, I ran:
HR@XE> @"C:\Documents and Settings\Jason\My Documents\Work\SQL\OPP5.WEB.CODE\OPP5.WEB.CODE\genaa.sp"
749 /
Procedure created.
HR@XE> exec genaa('EMPLOYEES');which generated a nice bunch of code, viz:
create or replace package EMPLOYEES_cache is
function onerow ( EMPLOYEE_ID_in IN HR.EMPLOYEES.EMPLOYEE_ID%TYPE) return HR.EMPLOYEES%ROWTYPE;
function onerow_by_EMP_EMAIL_UK (EMAIL_in IN HR.EMPLOYEES.EMAIL%TYPE) return HR.EMPLOYEES%ROWTYPE;
procedure test;
end EMPLOYEES_cache;
create or replace package body EMPLOYEES_cache is
TYPE EMPLOYEES_aat IS TABLE OF HR.EMPLOYEES%ROWTYPE INDEX BY PLS_INTEGER;
EMP_EMP_ID_PK_aa EMPLOYEES_aat;
TYPE EMP_EMAIL_UK_aat IS TABLE OF HR.EMPLOYEES.EMPLOYEE_ID%TYPE INDEX BY HR.EMPLOYEES.EMAIL%TYPE;
EMP_EMAIL_UK_aa EMP_EMAIL_UK_aat;
function onerow ( EMPLOYEE_ID_in IN HR.EMPLOYEES.EMPLOYEE_ID%TYPE)
return HR.EMPLOYEES%ROWTYPE is
begin
return EMP_EMP_ID_PK_aa (EMPLOYEE_ID_in);
end;
function onerow_by_EMP_EMAIL_UK (EMAIL_in IN HR.EMPLOYEES.EMAIL%TYPE)
return HR.EMPLOYEES%ROWTYPE is
begin
return EMP_EMP_ID_PK_aa (EMP_EMAIL_UK_aa (EMAIL_in));
end;
procedure load_arrays is
begin
FOR rec IN (SELECT * FROM HR.EMPLOYEES)
LOOP
EMP_EMP_ID_PK_aa(rec.EMPLOYEE_ID) := rec;
EMP_EMAIL_UK_aa(rec.EMAIL) := rec.EMPLOYEE_ID;
end loop;
END load_arrays;
procedure test is
pky_rec HR.EMPLOYEES%ROWTYPE;
EMP_EMAIL_UK_aa_rec HR.EMPLOYEES%ROWTYPE;
begin
for rec in (select * from HR.EMPLOYEES) loop
pky_rec := onerow (rec.EMPLOYEE_ID);
EMP_EMAIL_UK_aa_rec := onerow_by_EMP_EMAIL_UK (rec.EMAIL);
if rec.EMPLOYEE_ID = EMP_EMAIL_UK_aa_rec.EMPLOYEE_ID then
dbms_output.put_line ('EMP_EMAIL_UK lookup OK');
else
dbms_output.put_line ('EMP_EMAIL_UK lookup NOT OK');
end if;
end loop;
end test;
BEGIN
load_arrays;
end EMPLOYEES_cache;
/which I have run successfully:
HR@XE> @"C:\Documents and Settings\Jason\My Documents\Work\SQL\EMPLOYEES_CACHE.sql"
Package created.
Package body created.I am now trying to use the functionality within the package.
I have figured out that the section
BEGIN
load_arrays;
end EMPLOYEES_cache;
/is the initialization section, and my understanding is that this is supposed to run when any of the package variables or functions are referenced. Is that correct?
With that in mind, I'm trying to call the onerow() function, but it's not working:
HR@XE> select onerow(100) from dual;
select onerow(100) from dual
ERROR at line 1:
ORA-00904: "ONEROW": invalid identifier
HR@XE> select employees_cache.onerow(100) from dual;
select employees_cache.onerow(100) from dual
ERROR at line 1:
ORA-06553: PLS-801: internal error [55018]
HR@XE> select table(employees_cache.onerow(100)) from dual;
select table(employees_cache.onerow(100)) from dual
ERROR at line 1:
ORA-00936: missing expressionHe provides the code genaa.sp, and a very brief description of what it does, but doesn't tell us how to run the generated code!
Now, I have just done some googling, and it seems that what I am trying to do isn't possible. Apparently %ROWTYPE is PL/SQL, and not understood by SQL, so you can't call onerow() from sql. Correct?
So I try wrapping the call in an exec:
HR@XE> exec select employees_cache.onerow(100) from dual;
BEGIN select employees_cache.onerow(100) from dual; END;
ERROR at line 1:
ORA-06550: line 1, column 30:
PLS-00382: expression is of wrong type
ORA-06550: line 1, column 7:
PLS-00428: an INTO clause is expected in this SELECT statement
HR@XE> exec select table(employees_cache.onerow(100)) from dual;
BEGIN select table(employees_cache.onerow(100)) from dual; END;
ERROR at line 1:
ORA-06550: line 1, column 14:
PL/SQL: ORA-00936: missing expression
ORA-06550: line 1, column 7:
PL/SQL: SQL Statement ignored
HR@XE> exec employees_cache.onerow(100)
BEGIN employees_cache.onerow(100); END;
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00221: 'ONEROW' is not a procedure or is undefined
ORA-06550: line 1, column 7:
PL/SQL: Statement ignoredNo joy.
Of course, now that I'm looking at it again, it seems that the way to go is indicated by the first error:
PLS-00428: an INTO clause is expected in this SELECT statement
So am I supposed to create a type of EMPLOYEES%ROWTYPE in a PL/SQL procedure, and the idea of this code, is that the first call to onerow() runs the initialiation code, which populates the cache, and all subsequent calls to onerow() (whether by my session or any other) will use the cache?
I've had a stab at this, but still, no joy:
create or replace procedure testcache is
emp employees%rowtype;
begin
select employees_cache.onerow(100) from dual into emp;
dbms_output.put_line('Emp id: ' || emp.employee_id);
end testcache;
show errors
HR@XE> @testcache.sql
Warning: Procedure created with compilation errors.
Errors for PROCEDURE TESTCACHE:
LINE/COL ERROR
4/9 PL/SQL: SQL Statement ignored
4/54 PL/SQL: ORA-00933: SQL command not properly ended
HR@XE>Have a feeling this should be really easy. Can anybody help?
Many thanks in advance.
Jason
Edited by: 942375 on 08-Feb-2013 11:45>
Ha, figured it out
>
Hopefully you also figured out that the example is just that: a technical example of how to use certain Oracle functionality. Unfortunately it is also an example of what you should NOT do in an actual application.
That code isn't scaleable, uses expensive PGA memory, has no limit on the amount of memory that might be used and, contrary to your belief will result in EVERY SESSION HAVING ITS OWN CACHE of exactly the same data if the session even touches that package.
Mr. Feuerstein is an expert in SQL and PL/SQL and his books cover virtually all of the functionality available. He also does an excellent job of providing examples to illustrate how that functionality can be combined and used. But the bulk of those examples are intended solely to illustrate the 'technical' aspects of the technology. They do not necessarily reflect best practices and they often do not address performance or other issues that need to be considered when actually using those techniques in a particular application. The examples show WHAT can be done but not necessarily WHEN or even IF a given technique should be used.
It is up to the reader to learn the advantages and disadvantages of each technicalogical piece and determine when and how to use them.
>
Now, I have just done some googling, and it seems that what I am trying to do isn't possible. Apparently %ROWTYPE is PL/SQL, and not understood by SQL, so you can't call onerow() from sql. Correct?
>
That is correct. To be used by SQL you would need to create SQL types using the CREATE TYPE syntax. Currently that syntax does not support anything similar to %ROWTYPE.
>
So am I supposed to create a type of EMPLOYEES%ROWTYPE in a PL/SQL procedure, and the idea of this code, is that the first call to onerow() runs the initialiation code, which populates the cache, and all subsequent calls to onerow() (whether by my session or any other) will use the cache?
>
NO! That is a common misconception. Each session has its own set of package variables. Any session that touches that package will cause the entire EMPLOYEES table to be queried and stored in a new associative array specifically for that session.
That duplicates the cache for each session using the package. So while there might be some marginal benefit for a single session to cache data like that the benefit usually disappears if multiple sessions are involved.
The main use case that I am aware of where such caching has benefit is during ETL processing of staged data when the processing of each record is too complex to be done in SQL and the records need to be BULK loaded and the data manipulated in a loop. Then using an associative array as a lookup table to quickly get a small amount of data can be effective. And if the ETL procedure is being processed in parallel (meaning different sessions) then for a small lookup array the additional memory use is tolerable.
Mitigating against that is the fact that:
1. Such frequently used data that you might store in the array is likely to be cached by Oracle in the buffer cache anyway
2. Newer versions of Oracle now have more than one cache
3. The SQL query needed to get the data from the table will use a bind variable that eliminates repeated hard parsing.
4. The cursor and the buffer caches ARE SHARED by multiple sessions globally.
So the short story is that there would rarely be a use case where ARRAYs like that would be preferred over accessing the data from the table. -
How to call a Stored Function with OUT parameter of %rowType from Java
Hi everyone,
I'm getting crazy trying to make this work.
I have a function (not developed by me) in Oracle 10g declared in this way:
type tab_RLSSP is table of TB_RLSSP_STOSTPRPAR_CL%ROWTYPE index by binary_integer;
FUNCTION DBF_PERL_LISTA_PRATICHE (
p_id_va IN NUMBER,
p_seq_partita IN NUMBER,
p_trattamento IN CHAR,
lrec_RLSSP OUT tab_RLSSP ) RETURN NUMBER;
And here is the code snipplet of my java method:
sql="{? = call "+SCHEMA+PACKAGE+"."+FUNCTION_LIST+"(?,?,?,?)}";
cs=connection.prepareCall(sql);
cs.registerOutParameter(1, OracleTypes.NUMBER);
cs.setLong(2,idVATitolare);
cs.setLong(3,seqPartita);
cs.setString(4,trattamento);// Caso Decesso
cs.registerOutParameter(5, OracleTypes.OTHER);
cs.executeQuery();
result = (ResultSet) cs.getObject(5);
if (result.next())
listaPratiche.add(readPraticaPartita(result));
The result (exception thrown at executeQuery with statement generated as
SQL : {? = call PEDBA.DBK_PERL_RATEI_SUPPLETIVI.DBF_PERL_LISTA_PRATICHE(?,?,?,?)}:
java.sql.SQLException: ORA-06550: line 1, column 13:
PLS-00306: wrong number or types of arguments in call to 'DBF_PERL_LISTA_PRATICHE'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Changing to :
sql="{call ? := "+SCHEMA+PACKAGE+"."+FUNCTION_LISTA+"(?,?,?,?)}";
leading to
SQL : {call ? := call PEDBA.DBK_PERL_RATEI_SUPPLETIVI.DBF_PERL_LISTA_PRATICHE(?,?,?,?)}
don't change anything.
What's wrong? Any suggestion?
Edited by: 957158 on 5-set-2012 9.06>
Taking for granted that it works, I wonder what's different, probably the output is defined as Cursor...
>
You mean because of this line?
cs.registerOutParameter(5,OracleTypes.CURSOR);You can either use a cursor or use a function that returns a SQL type instead of the PL/SQL type.
Here is sample code using a cursor
CREATE OR REPLACE TYPE SCOTT.local_type IS OBJECT (
empno NUMBER(4),
ename VARCHAR2(10));
CREATE OR REPLACE TYPE SCOTT.local_tab_type IS TABLE OF local_type;
CREATE OR REPLACE PACKAGE SCOTT.test_refcursor_pkg
AS
TYPE my_ref_cursor IS REF CURSOR;
-- add more cursors as OUT parameters
PROCEDURE test_proc(p_ref_cur_out OUT test_refcursor_pkg.my_ref_cursor);
END test_refcursor_pkg;
CREATE OR REPLACE PACKAGE BODY SCOTT.test_refcursor_pkg
AS
PROCEDURE test_proc(p_ref_cur_out OUT test_refcursor_pkg.my_ref_cursor)
AS
l_recs local_tab_type;
BEGIN
-- Get the records to modify individually.
SELECT local_type(empno, ename) BULK COLLECT INTO l_recs
FROM EMP;
-- Perform some complex calculation for each row.
FOR i IN l_recs.FIRST .. l_recs.LAST
LOOP
DBMS_OUTPUT.PUT_LINE(l_recs(i).ename);
END LOOP;
-- Put the modified records back into the ref cursor for output.
OPEN p_ref_cur_out FOR
SELECT * from TABLE(l_recs);
-- open more ref cursors here before returning
END test_proc;
END;
SET SERVEROUTPUT ON SIZE 1000000
DECLARE
l_cursor test_refcursor_pkg.my_ref_cursor;
l_ename emp.ename%TYPE;
l_empno emp.empno%TYPE;
BEGIN
test_refcursor_pkg.test_proc (l_cursor);
LOOP
FETCH l_cursor
INTO l_empno, l_ename;
EXIT WHEN l_cursor%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(l_ename || ' | ' || l_empno);
END LOOP;
CLOSE l_cursor;
END;
/ -
Element name too long when using ROWTYPE
I've come across an issue with xml element names longer than 30 characters. Seems it has something to do with ROWTYPE. Creation of this function is successful:
<pre>
CREATE OR REPLACE FUNCTION test_fnc
RETURN XMLTYPE
AS
var_return XMLTYPE;
l_dummy DUAL.dummy%TYPE;
BEGIN
SELECT dummy INTO l_dummy FROM DUAL;
SELECT XMLCONCAT(XMLELEMENT (
"TEST",
XMLFOREST (
l_dummy "THIS_IS_OVER_30_CHARACTERS_LONG"
data_set
INTO var_return
FROM DUAL;
RETURN var_return;
END test_fnc;
</pre>
However, specifying the variable as ROWTYPE gives ORA-00972 error (unless I shorten the element name...):
<pre>
CREATE OR REPLACE FUNCTION test_fnc
RETURN XMLTYPE
AS
var_return XMLTYPE;
l_dummy DUAL%ROWTYPE;
BEGIN
SELECT dummy INTO l_dummy FROM DUAL;
SELECT XMLCONCAT(XMLELEMENT (
"TEST",
XMLFOREST (
l_dummy.dummy "THIS_IS_OVER_30_CHARACTERS_LONG"
data_set
INTO var_return
FROM DUAL;
RETURN var_return;
END test_fnc;
</pre>
Has anyone come across this before, or have any ideas for a solution? I could specify all my variables as TYPE but as there are many within the tables it would be easier to use ROWTYPE.
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
Thanks.it works if you add "AS" after l_dummy.dummy
SQL> CREATE OR REPLACE FUNCTION test_fnc
2 RETURN XMLTYPE
3 AS
4 var_return XMLTYPE;
5 l_dummy DUAL%ROWTYPE;
6 BEGIN
7 SELECT dummy INTO l_dummy FROM DUAL;
8
9 SELECT XMLCONCAT(XMLELEMENT (
10 "TEST",
11 XMLFOREST (
12 l_dummy.dummy AS "THIS_IS_OVER_30_CHARACTERS_LONG"
13 )
14 ))
15 data_set
16 INTO var_return
17 FROM DUAL;
18 RETURN var_return;
19 END test_fnc;
20 /
Function created.Ants -
Can I call a function with an arguement of %ROWTYPE directly from SQL?
I have the following function in a 10g DB:
CREATE OR REPLACE FUNCTION f_is_eligible2 (in_dm_row IN amplify_dm%ROWTYPE)
RETURN NUMBER
IS
I know I can call that function from another pl/sql function but I'm wondering if I can call that function directly from a SQL statement, something like this:
SELECT f_is_eligible2(dm.*)
FROM amplify_dm dm
or
SELECT f_is_eligible2(dm%rowtype)
FROM amplify_dm dm
neither of those worked so I'm thinking it's not possible but I thought I'd ask anyway.
Thanks in advance!Not possible as said - but - based on what I'm seeing - you could simply pass the parameter(s) that are key on that table and - accomplish the same thing by modifying the function.
not sure why you'd need the whole row if I'm interpretting the code excerpt. -
Hi Folks!
I have a report with a custom rowtype template (3 rows for each dataset) and I have fiddeled around with the build-in javascript sorting-function. (Cause as it seems you can't use the standard sorting functionality on custom rowtemplates.) I came up with a short solution, but I would like to know how safe this is.
Setup very simple:
The Header-Template [before rows]
<table id="myDomId">
<thead><tr>
<th><a href="javascript:sortCol(1)">Col1</a></th>
<th><a href="javascript:sortCol(2)">Details</a></th>
<th><a href="javascript:sortCol(3)">Col3</a></th>
</tr></thead>
Then the javascript handling runs like that:
var qmmSorter = {};
$(function(){
setupSorters();
function setupSorters(){
qmmSorter.DomCatch = /\d+/.exec($('#myDomId>div').attr('id'))[0];
qmmSorter.lastCol = 1;
qmmSorter.asc = true;
function sortCol(colnum){
//console.log(colnum);
if (qmmSorter.DomCatch) {
qmmSorter.lastCol = colnum;
qmmSorter.asc = !qmmSorter.asc;
javascript:apex.widget.report.sort( qmmDomCatch,'fsp_sort_'+colnum + ( qmmSorter.asc ? '' : '_desc') );
Maybe I'll also add some arrows to indicate what sorting took place. Tested so far in IE9 and Moz - all we really use in our internal network.
But this seems all a bit just too easy. so I'd be really thankful for your comments.
Tanks and greetings,
TobiTobiP wrote:
But this seems all a bit just too easy. so I'd be really thankful for your comments.
It would be even easier to use column header substitution and retain the built-in sort functionality (although this includes the sort direction image bug).
<table id="myDomId">
<thead><tr>
<th>#1#</th>
<th>#2#</th>
<th>#3#</th>
</tr></thead> -
[Forms10g (9.0.4)] error 310 with %ROWTYPE
I have a package specification in which i declare a user defined type and a function:
SUBTYPE services_record_type IS services%ROWTYPE;
FUNCTION services(services_record IN OUT services_record_type) RETURN BOOLEAN;
When i compile, i am getting this error:
Error 310 with %ROWTYPE attribute. 'SERVICES' must name a table, cursor or cursor-variable.
I've tried with the schema name:
SUBTYPE services_record_type IS star.services%ROWTYPE;
And it compiles with no error.
But, i rather prefer using my public synonym instead of an absolute reference 'schema-name.table_name'.
I also thought changing my function name 'services' to something else, and it also works.
In the Oracle Forms Developer online help, it is written that:
Unique Names Required within a Package
In PL/SQL V1, when you created a variable with the same name as a procedure or function in the same package, the variable was always used; the identically named procedure or function was ignored. In versions after V1, variables, functions, and procedures within the same package must be unique.
To avoid an error, make sure all procedures within a package have unique names, either by doing so explicitly, or by appending the word Unused to the procedure name.
In the White Paper : Upgrade Developer Forms 4.5 to Oracle Forms 6, it is stated that:
VARIABLES AND PROGRAM UNITS WITH SAME NAME IN SAME PACKAGE
It is no longer legal to have program units and variables with the same name in the same package.
The compiler cannot resolve which to reference. With PL/SQL V1 you may have gotten unexpected results at runtime, meaning that while coding you may have meant to reference the value of a variable, but intead got the return value of a function with the same name.
Oracle recommends prefixing all variable whith a 'v_'.
It seems to me that Forms Builder considers type declarations as being like variable or subprogram declarations and applies the same restriction on the naming of objects.
Yet in the reference books, no where there're issues uppon this restriction on type definition ?
Could someone help me please !
Message was edited by:
[email protected]
nullWe can not have object with same name in same schema
I agree with you, but in my case, i'm dealing with a packaged program unit :
PackageName.services.
In the naming space of my user star schema there cannot be conflict between all my object names. On one hand i have a table 'services' and on the other a package 'PackageName' in which i have a function 'services'.
Meanwhile, if i replace my public synonym services%ROWTYPE by an absolute reference to my table star.services%ROWTYPE, we're still in the same schema so same name space, no problem it compiles pretty well !
What do you think about it ?
. -
Declare custom type as %ROWTYPE variable in package
I am creating a bunch of custom RECORD types in a package specification like so:
CREATE OR REPLACE PACKAGE mypackage AS
TYPE t1 IS RECORD (a number, b number);
...For consistency, I'd like to create a custom package type that uses a table %ROWTYPE, something like this:
TYPE t2 IS RECORD (table%ROWTYPE);Is that possible in any way?
TomHi Tom.
You should read this: http://docs.oracle.com/cd/B10500_01/appdev.920/a96624/05_colls.htm
"The attribute %ROWTYPE lets you declare a record that represents a row in a database table. However, you cannot specify the datatypes of fields in the record or declare fields of your own. The datatype RECORD lifts those restrictions and lets you define your own records."
If you want to create a nested table of that records you can do this:
DECLARE
TYPE RecTab IS TABLE OF dept%ROWTYPE;
dept_recs RecTab;
...If you just need a record this may help you.
DECLARE
dept_rec dept%ROWTYPE;
...Hope this helps.
Regards. -
Rowtype not fetching all the rows
This my cursor declaration. When the Package is executed it get all records minus 1 (Assumming there are 10 rows to be processed, it ONLY processes 9 records)
cursor X1 is
select *
from NT
hdr X1%rowtype;
Below is the procedure call
open X1;
fetch X1 into hdr;
loop
exit when X1%notfound;
fetch X1 into hdr;
pkgXX.insrt(hdr);
end loop;
commit;
close X1;That makes sense. You 1) fetch a row, 2) check for %notfound, 3) fetch a row and process it. Notice that the row you fetched in 1 was never processed. Try this:
open X1;
loop
fetch X1 into hdr;
exit when X1%notfound;
pkgXX.insrt(hdr);
end loop;
commit;
close X1; -
Calling stored procedure with %rowtype as input
Hi!
Is it possible to call a pl/sql function that takes a table_name%rowtype as input with oracles jdbc implementation?
Regards
/ErikIt includes time element, if you want more precision go with timestamp.
http://docs.oracle.com/javase/6/docs/api/java/sql/Date.html -
I have created stored procedure with %rowtype as IN OUT parameter.I want to
i have created stored procedure with %rowtype as IN OUT parameter.I want to call it in java program
Hi Avi,
I have the same problem as the person asking before me, so I'll try and clarify:
I have a Java client and a PL/SQL database procedure that looks something along the lines of:
Create of Replace procedure myProc(myRow IN myTable%Rowtype)
It's very easy to pass a parameter into this procedure from another procedure within the database because creating another myTable%Rowtype is not a problem.
However, Java doesnt know what "Rowtype" is.
I was wondering how I would pass a "rowtype" from Java.
I was thinking along the lines of creating an object in the DB like that:
Create Type myObj AS myTable%Rowtype (<-- is that even allowed?)
And then create a procedure in the DB with the header:
Create of Replace procedure myProc(myRow IN myObj)
And then, in my Java,just create a STRUCT of my DB object and pass it to the DB:
myCallableStatement.setObject(1, myStruct);
Would that work?
Is there a better way?
Thanks,
Dan
Maybe you are looking for
-
How many computers can I store my iTunes library on?
I vaguely recall reading somewhere that I can put my iTunes library on up to five different computers. Since I first created my library, I've had to change laptops a few times (changed companies, laptop stolen, etc). Can I keep downloading iTunes sof
-
I share an Apple ID with someone but we are now on iOS8 and getting each others messages on our iphones and ipad. How can I split the account safely as well as protect icloud backed up data?
-
Message being used by another user
I am running office 2008, word version is 12.3.6, and Mtn Lion 10.8.3. I am trying to edit word template documents on the network. I used to open Word, go to File, select Open... and go to the template. The template would open and I would make the
-
Windows 2008 Server Enterprise R2 x64 and Perc 4/dc SCSI driver issue
Hello all, this is the first time posting so please forgive me if this has been posted here before. I did try to search this issue but zero returns. OK, I have a Dell PowerEdge 2900. I have just put a fresh install of MS Windows 2008 ENT. Server x6
-
*Hi Experts,* *This is kalyan and i am facing a issue in BI 7.20 VER from past 1 week am not able to solve.* *this issue is process chain scheduled daily basis and process chain getting failed failed from 01-01-2011 to till date* *but records availab