Questions tagged [sql-view]

A database view is a stored query. Its output automatically updates as underlying table data changes.

A database view does not store data as tables (temporary or otherwise) do; rather, it is a saved query that can be recalled and reused. Its output automatically updates as underlying table data changes.

Reference

990 questions
5
votes
3 answers

How to create a read only view in postgresql , similar to oracle?

I want to create read only view in PostgreSQL. We can create in Oracle, but unable to do in PostgreSQL. I tried to create a read only view but I get a syntax error at READ ONLY. CREATE OR REPLACE VIEW VIEW NAME() from table names where filter…
Prajna
  • 129
  • 1
  • 8
5
votes
2 answers

How to change a column data type in Oracle View?

I am trying to change a data type of a column in a Oracle View by executing the following statement: ALTER VIEW MODIFY (ID VARCHAR2(100)); I get the following error: Error starting at line : 1 in command - ALTER VIEW MODIFY…
Nikhil
  • 621
  • 1
  • 13
  • 25
5
votes
0 answers

SSIS OLEDB source error - Opening a rowset for SQL Server View failed

We have an SSIS package where we have used SQL server view as a data source by selecting data access mode as Table or view. The package has been scheduled to run daily using SQL Server Job. Most of the time the job gets executed without any issue,…
Sandeep T
  • 421
  • 8
  • 22
5
votes
2 answers

"ORA-01733: virtual column not allowed here" when inserting into a view

I created a view called "view_employee" like this: CREATE VIEW view_employee AS SELECT employee.surname || ', ' || employee.name AS comp_name, employee.sex, sections.name AS section_name, employee_age FROM sections, employee WHERE employee.section =…
user8992642
5
votes
1 answer

How can view depends on primary key constraint in postgres

Sometimes while bulk data loading it's recommended to temporary drop constraints and indexes on table. But when I am doing this I faced with some problems with dependency. My simplified example: CREATE TABLE public.t_place_type ( id serial NOT…
Ivan Mogila
  • 437
  • 2
  • 9
5
votes
1 answer

Put query hint (OPTION) into view in SQL Server

I have an SQL query on a view using several joins that is occasionally running really slow - a lot slower than normal, making the query nearly unusable. I copied the query out of the view and experimented and found a solution at…
Andreas Reiff
  • 7,961
  • 10
  • 50
  • 104
5
votes
2 answers

Error creating MySQL view in phpMyAdmin

I'm having a hard time trying to create a view in phpMyAdmin. I have a database named myDB and a table named myTable. In phpMyAdmin I click on the SQL tab, type in : SHOW CREATE VIEW myView; I got this error MySQL said: #1146 - Table…
Rich
  • 121
  • 1
  • 2
  • 7
5
votes
1 answer

Views have no rowid values

Views have no rowid, is that expected? Example: create table t2 (u text); insert into t2 values ('x'); insert into t2 values ('y'); create table t1 (t text, i integer); insert into t1 values ('a',1); insert into t1 values ('b',2); insert into t1…
Phi
  • 735
  • 7
  • 22
5
votes
2 answers

mysql CREATE VIEW not working from mysql_query

I have a code to create VIEW in mysql database which is working fine on my local server. It creates and crop view normally. But on my Online server it gives error "CREATE VIEW command denied to user" for online database I manually create VIEW in…
Naresh
  • 785
  • 1
  • 11
  • 23
5
votes
1 answer

how to make MySql View Filter each table when fetched

I have a view witch is work like so: CREATE VIEW v_myView as SELECT * FROM( (SELECT a,b,c,d FROM table1) UNION ALL (SELECT a,b,c,d FROM table2) UNION ALL (SELECT a,b,c,d FROM table3) . . .) When I use the…
No Idea For Name
  • 11,411
  • 10
  • 42
  • 70
5
votes
1 answer

Using views for access control in PostgreSQL

I have a schema of tables whose contents basically boil down to: A set of users A set of object groups An access control list (acl) indicating what users have access to what groups A set of objects, each of which belongs to exactly one group. I…
Joey Adams
  • 41,996
  • 18
  • 86
  • 115
5
votes
1 answer

Comparing The Performance Of Indexed Views And Stored Procedures In SQL Server

I've just recently become aware of the fact that you can now index your views in SQL Server (see http://technet.microsoft.com/en-us/library/cc917715.aspx). I'm now trying to figure out when I'd get better performance from a query against an indexed…
Nullqwerty
  • 1,140
  • 1
  • 20
  • 37
5
votes
1 answer

Triggers on Views in PostgreSQL

I want to create a trigger for my view in PostgreSQL. The idea is that all new data must fulfill a condition to be inserted. But something is wrong here and I can't find the answer in manuals. CREATE OR REPLACE VIEW My_View AS SELECT name, adress,…
Ariel Grabijas
  • 1,472
  • 5
  • 25
  • 45
5
votes
2 answers

When using Toad to create a view in Oracle, how can I store the formatted script also?

This question may be Toad specific. I have no idea how Oracle stores views, so I'll explain what happens when I use Toad. If I get an answer that is Oracle specific, so much the better. I have created a rather complex view. To make it clearer, I…
Svein Bringsli
  • 5,640
  • 7
  • 41
  • 73
5
votes
1 answer

How manage a VIEW with Doctrine 2?

I would like mapping a sql-view with Doctrine2. This view is a TempTable containing some statistics that would show without rewriting the sql that generates the view I try to map like a table, but updating schema drop the view and create a table I…
Ephraim
  • 260
  • 1
  • 6
  • 15