Home > Archive > ASE Database forum > December 2005 > Creating views with arguments









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Creating views with arguments
Raj Narayan

2005-12-22, 11:24 am

The present create view Syntax (12.5.1) does NOT allow for
arguments to be specified. Is it possible at all to create
views with Arguments?
species8472

2005-12-22, 1:24 pm

Raj Narayan wrote:
> The present create view Syntax (12.5.1) does NOT allow for
> arguments to be specified. Is it possible at all to create
> views with Arguments?


Can you specify what you mean by arguments?

stored procs and functions have arguments
tables and views have where clauses

joop

--
Senior Consultant Sybase Professional Services

The worst thing one can do is not to try, to be aware of what one wants and
not give in to it, to spend years in silent hurt wondering if something
could
have materialized -- and never knowing.
-- David Viscott
Eugene Korolkov

2005-12-22, 8:25 pm

I think he meant something like this:
create view <view_name>
as
select ... <colmn>,...
......
where ...<colnn>=@arg1...
like some kind of "dynamic" view

Regards,
Eugene
species8472 wrote:

> Raj Narayan wrote:
>
>
>
> Can you specify what you mean by arguments?
>
> stored procs and functions have arguments
> tables and views have where clauses
>
> joop
>



Mark A. Parsons

2005-12-22, 8:25 pm

You may want to post a detailed example of what you're trying to do.

Generally speaking you could define a view like such:

create view1 as
select <select_list>
from table1

Now, if you were to access the view with something like:

select * from view1
where <some_view_column> = @var1

The value of @var1 will be 'passed to the view' and used to select only
those records from view1 that match your 'where' criteria.

Obviously the definition of your view can be much more extensive ... select
from multiple tables (and/or other views), have sub-queries, have
aggregations, etc.

Raj Narayan wrote:

> The present create view Syntax (12.5.1) does NOT allow for
> arguments to be specified. Is it possible at all to create
> views with Arguments?

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com