Hi, i need to return the result of the query from this procedure, where can i store this data - create or replace PROCEDURE RELACIONA_DATOS(
-
p_CVE_TABLA IN NUMBER,
-
p_CVE_TIPO_DATOENT IN NUMBER,
-
p_res OUT ?????????????
-
) AS
-
-
nom_atr_tbl RELACIONES.NOMBRE%TYPE;
-
NOM CAT_ATRIBUTO_TBL.NOMBRE_ATRIBUTO%TYPE;
-
-
-
BEGIN
-
select r.NOMBRE,
-
(select NOMBRE_ATRIBUTO
-
FROM CAT_ATRIBUTO_TBL CATTR
-
WHERE CATTR.CVE_ATRIBUTO = r.CVE_ATR_IND_REC) NOMBREBIO
-
INTO nom_atr_tbl, NOM ????????????????????????????????
-
FROM CAT_ATRIBUTO_TBL c, RELACIONES r
-
WHERE CVE_TABLA = p_CVE_TABLA
-
AND CVE_ATRIBUTO IN (SELECT CVE_ATRIBUTO
-
FROM DATOENT_ATRIBUTO
-
WHERE CVE_DATOENT IN (SELECT CVE_DATOENT
-
FROM DATO_ENTRADA
-
WHERE CVE_TIPO_DATOENT = p_CVE_TIPO_DATOENT)
-
)
-
AND c.CVE_ATRIBUTO = r.CVE_ATRIBUTO_TABLA_REQUERIDA;
-
END RELACIONA_DATOS;
what i get from this query is - NOMBRE | NOMBREBIO
-
-
tipoDocProbClave CVE_DOCTO_PROB
-
curpDocumProbNum | AN_NUM_ACTA
-
tipoDocProbClave | AN_FECHA_REG
-
curpDocumProbNum | AN_TOMO
-
tipoDocProbClave | AN_LIBRO
-
curpDocumProbNum | AN_FOJA
-
tipoDocProbClave | AN_ENTIDAD_REG
-
curpDocumProbNum | AN_ID_MUNICIPIO
-
curpDocumProbNum | AN_CRIP
4 2511
you have to decide what you are doing with the data. You can insert the rows from the query into a table or you can use a ref cursor etc ... there are many things you can do to get at the data.
you have to decide what you are doing with the data. You can insert the rows from the query into a table or you can use a ref cursor etc ... there are many things you can do to get at the data.
How can i use a ref cursor, im new to this and im not sure how to use it, ive tried several things: - create or replace PROCEDURE RELACIONA_DATOS(
-
p_CVE_TABLA IN NUMBER,
-
p_CVE_TIPO_DATOENT IN NUMBER,
-
p_res OUT REL_EST%ROWTYPE
-
) AS
REL_EST is a table with the structure i want
I also tried this - PROCEDURE RELACIONA_DATOS(
-
p_CVE_TABLA IN NUMBER,
-
p_CVE_TIPO_DATOENT IN NUMBER,
-
p_res OUT cursor_type
-
);
cursor type is a ref cursor declared in apackage but i cant get it to work...
any ideas?
what will be receiving the out parameter of type ref cursor? is it another pl/sql package/procedure or is it another language which can automatically determine the columns involved with the ref cursor (such as vb.net)? I ask this because if you use weakly typed ref cursors then you need to make sure that the calling procedure with the IN parameter of sys_refcursor has all the correct columns accounted for in the fetch.
an example of a out ref cursor can be found here: http://www.psoug.org/reference/ref_cursors.html
How can i use a ref cursor, im new to this and im not sure how to use it, ive tried several things: - create or replace PROCEDURE RELACIONA_DATOS(
-
p_CVE_TABLA IN NUMBER,
-
p_CVE_TIPO_DATOENT IN NUMBER,
-
p_res OUT REL_EST%ROWTYPE
-
) AS
REL_EST is a table with the structure i want
I also tried this - PROCEDURE RELACIONA_DATOS(
-
p_CVE_TABLA IN NUMBER,
-
p_CVE_TIPO_DATOENT IN NUMBER,
-
p_res OUT cursor_type
-
);
cursor type is a ref cursor declared in apackage but i cant get it to work...
any ideas?
Can you POST your PACKAGE code for reference. Why is your cur_type not working:
check the below code for reference: -
-
SQL> create or replace package tttt AS
-
2 TYPE cur IS REF CURSOR;
-
3 PROCEDURE tttt1(a NUMBER, b OUT cur);
-
4 END tttt;
-
5 /
-
-
Package created.
-
-
SQL> create or replace package body tttt AS
-
2 PROCEDURE tttt1(a NUMBER, b OUT cur) IS
-
3 BEGIN
-
4 OPEN b FOR SELECT * FROM EMP where empno = a;
-
5 END tttt1;
-
6 end tttt;
-
7 /
-
-
Package body created.
-
-
SQL> ed
-
Wrote file afiedt.buf
-
-
1 declare
-
2 a SYS_REFCURSOR;
-
3 emp_rec EMP%ROWTYPE;
-
4 begin
-
5 tttt.tttt1(1,a);
-
6 LOOP
-
7 FETCH a INTO emp_rec;
-
8 EXIT WHEN a%NOTFOUND;
-
9 dbms_output.put_line(emp_Rec.ename||','||emp_rec.empno);
-
10 END LOOP;
-
11* end;
-
SQL> /
-
BOND,1
-
-
PL/SQL procedure successfully completed.
-
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Rhino |
last post by:
Is it possible for a Java Stored Procedure in DB2 V7.2 (Windows) to pass a
Throwable back to the calling program as an OUT parameter?
If yes, what datatype should I use when registering the...
|
by: Terentius Neo |
last post by:
Is it possible to combine (in DB2 UDB 8.1) a stored procedure and a
select statement? I mean something like this:
Select
c.number,
call procedure( c.number ) as list
from
table c
With best...
|
by: Dino L. |
last post by:
How can I run stored procedure (MSSQL) ?
|
by: Eli |
last post by:
Hi all
We currently have a strange problem with calling a Stored Procedure
(SQL Database) in our C# Project. The only error I get is "System
error" which says a lot :)
Background:
We have...
|
by: Amber |
last post by:
Stored procedures are faster and more efficient than in-line SQL
statements. In this article we will look at two SQL Server stored
procedures; one using an input parameter and one not, and see how...
|
by: Leon |
last post by:
How can I code a stored procedure "within my codebehind page" that execute
two or more stored procedures within a transaction?
if so how would I pass values to each parameter?
i.e.
Begin Tran...
|
by: John |
last post by:
Hi
When developing vb.bet winform apps bound to sql server datasource, is it
preferable to use SELECTs or stored procedure to read and write data from/to
SQL Server? Why?
Thanks
Regards
|
by: mooreit |
last post by:
The purpose for my questions is accessing these technologies from
applications. I develop both applications and databases. Working with
Microsoft C#.NET and Microsoft SQL Server 2000 Production and...
|
by: Dabbler |
last post by:
I'm using an ObjectDataSource with a stored procedure and am getting the
following error when trying to update (ExecuteNonQuery):
System.Data.SqlClient.SqlException: Procedure or Function...
|
by: jed |
last post by:
I have created this example in sqlexpress
ALTER PROCEDURE .
@annualtax FLOAT
AS
BEGIN
SELECT begin1,end1,deductedamount,pecentageextra
FROM tax
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |