2

A view with Sybase engine cannot take parameters. Is there a way to do this?

1 Answer 1

4

Solution is to create procedure with use of dynamic query:

CREATE PROCEDURE view_with_parms( in str1 varchar(255), in str2 varchar(50) ) 
RESULT(
  myID integer,
  someName varchar(255))
BEGIN
    EXECUTE ( 'select myID, someName from ' || str1 || ' order by ' || str2 || ' asc' );
END

then:

select * from view_with_parms('test_table','myID');

Tested with:

  • SQL Anywhere 9
  • SQL Anywhere 12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.