convert sql query to plsql FUNCTION [message #359386] |
Sat, 15 November 2008 11:13 |
dreidu
Messages: 2 Registered: November 2008 Location: Sta Iria
|
Junior Member |
|
|
hello i'm new to this oracle pl-sql business and i'm trying to do something for my school project that i need to have some query on a function in oracle pl-sql
i'm having some problems understanding it. i'm not very good at sql but i'll try to make you understand my problem.
imagine i have tables A and table B
A has id
and name
B has
id
idA
name
and i want to have a simple function returning the top 5 A elements
something like this in SQL
Select top 5 a
from A as a, B as b
where a.id = b.idA and b.name like %VAR%
order by a.id
how could i have a function that would give me something like this in pl sql?
TYPE typ_b IS REF CURSOR RETURN B%ROWTYPE;
FUNCTION top5( word IN B.name%TYPE)
RETURN typ_b;
[Updated on: Sat, 15 November 2008 11:13] Report message to a moderator
|
|
|