on ‎2012 Apr 18 4:23 PM
I need to convert the followinf function to SQL Anywhere. Here is the code:
CREATE OR REPLACE FUNCTION f_get_name_address_list (p_name_and_address_id IN varchar2) RETURN SYS_REFCURSOR IS v_ret SYS_REFCURSOR; BEGIN OPEN v_ret FOR SELECT c.name_and_address_id, c.full_name, c.parent_record_id, LEVEL pass FROM s1_name_and_address c START WITH c.name_and_address_id = p_name_and_address_id CONNECT BY NOCYCLE PRIOR c.name_and_address_id = c.parent_record_id; RETURN v_ret; END;
How do I handle "Start with" and "Connect by"?
I am using SQL Anywhere 11.0.1.2755
Request clarification before answering.
Regarding the return of a cursor, the last query executed will be returned automatically without defining a cursor. Example:
CREATE OR REPLACE PROCEDURE get_name_address_list (IN p_name_and_address_id varchar) BEGIN SELECT c.name_and_address_id, c.full_name, c.parent_record_id, LEVEL pass FROM s1_name_and_address c END
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 12 | |
| 9 | |
| 7 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.