Alter view

hi
how can we use alter view to update view by coding in vb.net    thanks

"alter view to update view" could mean many things.  Here are a couple of interpretations:
(1) Redefine a database view to retrieve different data.
Don't. 
Unless you're writing an application that will maintain database structures, this isn't something you should be doing from application code.  Indeed, the account used by your application should not have any database permissions to do this.  Work
with tables, views, etc., but don't change them. 
(2) Change the permissions on a View so that you can perform Updates through it.
Don't. 
See (1).
Also, some views retrieve data from many tables, making it impossible use them in this way.  
Regards, Phill W.

Similar Messages

  • Problem with Alter View

    Hello folk,
    It´s my first post here!
    I Hope that I can help us in question and ask!
    I have a dificult to alter table command.
    I think that I do nothing wrong, follow the command:
    ALTER VIEW desenv_pw.PRCR_MCVW903_CSP_DIM
    (CSP, DESCRIPTION)
    AS
    SELECT
    CARR_IDEN_CARRIER CSP,
         CASE
              WHEN CARR_DESC_CARRIER = 'Não identificado'
                   THEN 'Outros'
              ELSE CARR_DESC_CARRIER
         END DESCRIPTION
    FROM
    PWMART.BITB66_CARRIER_DIM
    WHERE
         BITB66_CARRIER_DIM.CARR_IDEN_CARRIER IN (0,25,99);
    Thanks for help me !
    Paulo Cauca

    Ok Thank´s for help SKU !
    I can´t use de command "Alter" to view in Oracle ?
    But with create or replace command worked well !!!
    Thank's again !!
    Paulo Cauca

  • Altering Views in Oracle 10.2

    Hi,
    I have a requirement that we need to change code of some views before running some daily batches (part of the code is not required for running the daily batches) and then revert back to the original code once the daily batches finish. Instead of using alter view command daily, I though about creating a new view for the modified code which will be used for running the batches and just swap the names of the two views before running the daily batches and then revert back after batches completion.
    Any suggestion on this?
    Thanks,
    Younis

    Instead of modifying the view, why not have 2 different Views and a Synonym for the "correct" view. The Application Code references only the synonym and you have "pre-Batch" and "post-Batch" commands to drop and recreate the Synonym to point to the "correct" view. That way, no objects get invalidated !
    SQL> create table TAB_A as
      2  select 'HEMANT' as owner, object_name, object_type, created
      3  from user_objects;
    Table created.
    SQL> create table TAB_B as
      2  select owner, object_name, object_type, created
      3  from dba_objects;
    Table created.
    SQL> create view UNIONALL_VIEW as select * from TAB_A union all select * from TAB_B;
    View created.
    SQL> create view UNION_VIEW  as select * from TAB_A union select * from TAB_B;
    View created.
    SQL> select count(*) from UNIONALL_VIEW;
      COUNT(*)
         46290
    SQL> select count(*) from
      2  UNION_VIEW;
      COUNT(*)
         45927
    SQL>
    SQL> create synonym my_view for UNIONALL_VIEW ;
    Synonym created.
    SQL> select count(*) from my_view;
      COUNT(*)
         46290
    SQL> drop synonym my_view;
    Synonym dropped.
    SQL>
    SQL> select object_name from user_objects where status = 'INVALID';
    OBJECT_NAME
    list shows other objects that we are not interested in
    SQL>
    SQL>  create synonym my_view for UNION_VIEW;
    Synonym created.
    SQL> select object_name from user_objects where status = 'INVALID';
    OBJECT_NAME
    list shows other objects that we are not interested in
    SQL>
    SQL> select count(*) from my_view;
      COUNT(*)
         45927
    SQL>Hemant K Chitale

  • Transactional Replication: Alter view changes are not reflect on Subscription database

    Hi All,
    we are configured transactional replication in our environment on sql server 2008 R2 , Yesterday I made a view alter on publisher database the view also present in replicated articles but unfortunately the changes not reflect in subscription, I already have
    checked the : Replicate Schema change option in Subscription option its also true, there is not latency exist in replication monitor , i have checked the blocking on subscription and publication. one more thing I tested the changes on replicated table its
    working fine
    Please help me to fix the issue.
    Regards,
    Pawan Singh
    Thanks

    Hi Pawan,
    According to your description, the alter on the view in publication doesn't be reflected in subscription database. As my analysis, the issue could be caused by that the distribution agent job doesn’t run after altering the view.
    I make a test on my computer, and set up transactional replication to replicate tables and views. Firstly, when creating subscription, I set the distribution agent job ‘Run continuously’(as the screenshot below), and alter the view in publication database,
    then the change is successfully reflected to the corresponding view in subscription database.
    However, I also make another test with setting the distribution agent job ‘Run on demand only’(It is determined by you), and find that it is not reflected to subscription database unless I run the distribute agent job manually.
    The distribution agent is used to read the updated transactions written to the distribution database and applies the change to the subscription database, so please check if your distribution agent job runs after you alter the view. If not, please run the
    job and check if the issue still occurs.
    Regards,
    Michelle Li

  • Option to alter view of conversations in Messages gone

    As per the title, in Mavericks you were able to alter the way that conversations displayed in Messages, you had a choice of three options via the View menu. In Yosemite, that option in the menu has gone and the only way to view conversations is the speech bubbles look á la iOS, I preferred one of the other views when viewing Messages on a desktop .

    for the   Points
    It does seem that the general push to make the OS more like iOS does lead to this situation where something that worked and was understood no longer fits that criteria.
    I think most people would understand that a Computer version of something is capable of offering more.
    In Messages (and ichat before that) you used to be able to Format Text chats. ( It is still possible, to a lesser extent that earlier versions, but you have to go to System Preferences > Accessibility and Reduce Transparency then Restart Messages) The standard Preferences Pane and Format Menu have been removed.
    The iOS version can apply any sound that is on the iPhone or iPad to a particular Contact when they "call " in various apps.
    This is no longer possible in Messages on the Mac.
    It does seem that in an attempt to streamline various interfaces to match the two OS versions that functions are being withdrawn.
    8:18 pm      Tuesday; January 20, 2015
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • Why does sp_Refrehview revert my altered view to an older version?

    Last night I altered one of my views. Where I work, it is custom to run sp_refreshview after changing any views due to the sheer number of views utilized at my job. I noticed that after I altered my view and after I ran sp_Refreshview, the view had changed.
    The view no longer reflected the changes I had made in my alter statement last night. Why is this happening? I looked online and couldn't find much information. Any thoughts/tips/ideas would be greatly appreciated. Thanks

    My guess is it was not properly altered or schema/db was different 
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • GRANTS to execute ALTER VIEW .... COMPILE

    Hi,
    We're developing a system to remote distribution of oracle objects like VIEWS, TRIGGERS, PACKAGES...
    In Oracle we have a special user to create any of this objects in any schema of the database.
    In order to verify the status of the object recently created, we execute a ALTER OBJECT ... COMPILE, but when we try to compile a VIEW an error of insufficient privileges raises us.
    Which most restrictive roles we have to give our user to do this operation.
    Thanks in advance.
    Javier

    Hi,
    According to Oracle documentation the limitation is as follows:
    * view must be in your own schema or
    * you must have ALTER ANY TABLE system privilege.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_4004.htm
    Why not do select status from all_objects to see the status of the view (if it's valid or not)?

  • How to alter a view.

    i have created a table and its view.
    Is it possible to alter view? If yes, please explain. i have some confusion.
    I m new in oracle. thnks.

    rakeshor wrote:
    Is it possible to alter view? If yes, please explain. i have some confusion.You cannot really alter a view, but you can drop and recreate it

  • Warning: View altered with compilation errors. : Please help.

    Hi All,
    Found few views invalid, tried to compile them, but got the following error. It looks like synonyms are calling each other.
    Please help to compile the view.
    =======================
    SQL> alter view APPS.PER_ADDRESSES_AV12 compile;
    Warning: View altered with compilation errors.
    Checked error:
    SQL> SHOW errors VIEW APPS.PER_ADDRESSES_AV12;
    Errors for VIEW APPS.PER_ADDRESSES_AV12:
    LINE/COL ERROR
    0/0 ORA-01775: looping chain of synonyms
    Extracted DDL:
    ==========
    CREATE OR REPLACE FORCE VIEW "APPS"."PER_ADDRESSES_AV12" ("ROW_KEY", "ADDRESS_
    ID", "TOWN_OR_CITY") AS
    SELECT ROW_KEY, ADDRESS_ID, TOWN_OR_CITY FROM PER_ADDRESSES_A WHERE TOWN_OR_CI
    TY IS NOT NULL OR SUBSTR(AUDIT_TRUE_NULLS,12,1)='Y' UNION ALL SELECT 99991231235
    9591111122222 ROW_KEY, ADDRESS_ID, TOWN_OR_CITY FROM PER_ADDRESSES
    Checked synonyms for the base table:
    =======================
    OWNER SYNONYM_NAME TABLE_OWNER TABLE_NAME
    PUBLIC PER_ADDRESSES HR PER_ADDRESSES
    APPS PER_ADDRESSES HR PER_ADDRESSES
    XXHRC PER_ADDRESSES APPS PER_ADDRESSES
    Edited by: 784786 on Dec 22, 2011 7:27 AM

    784786 wrote:
    Found few views invalid, tried to compile them, but got the following error. It looks like synonyms are calling each other.
    Please help to compile the view.
    SQL> alter view APPS.PER_ADDRESSES_AV12 compile;
    Warning: View altered with compilation errors.
    SQL> SHOW errors VIEW APPS.PER_ADDRESSES_AV12;
    Errors for VIEW APPS.PER_ADDRESSES_AV12:
    LINE/COL ERROR
    0/0 ORA-01775: looping chain of synonyms
    CREATE OR REPLACE FORCE VIEW "APPS"."PER_ADDRESSES_AV12" ("ROW_KEY", "ADDRESS_
    ID", "TOWN_OR_CITY") AS
    SELECT ROW_KEY, ADDRESS_ID, TOWN_OR_CITY FROM PER_ADDRESSES_A WHERE TOWN_OR_CI
    TY IS NOT NULL OR SUBSTR(AUDIT_TRUE_NULLS,12,1)='Y' UNION ALL SELECT 99991231235
    9591111122222 ROW_KEY, ADDRESS_ID, TOWN_OR_CITY FROM PER_ADDRESSES
    OWNER SYNONYM_NAME TABLE_OWNER TABLE_NAME
    PUBLIC PER_ADDRESSES HR PER_ADDRESSES
    APPS PER_ADDRESSES HR PER_ADDRESSES
    XXHRC PER_ADDRESSES APPS PER_ADDRESSESso break the chain by dropping one or of them

  • How to find that who has altered a view.

    Can any one know how to find "*who has altered view in database?*" like user name, machine name or even OS user name nay thing atleast one of them if not all.
    When I checekd with
    SELECT last_ddl_time FROM all_objects where object_name = :object_name,
    I found its altered 5 days back.
    Any help would be appreciated.
    Thank you.

    Hi,
    The only way to achieve it is that you PREVIOUSLY audited that view.
    You can do that for the next time using the following procedure.
    http://www.oracle-base.com/articles/10g/Auditing_10gR2.php
    Regards,
    Mario Alcaide
    http://marioalcaide.wordpress.com

  • How to have rownum in a report based on a view

    How to use rownum in a report or tabular form?
    I wanted to number the rows in a report. The most obvious way would be just stick
    rownum in there. There is a view in a database1. It is merely select a,b,c from various
    things joined together and order by pkey1.
    Apex is in database2 so I have to create a view there across the link
    like:
    create or replace view SOME_VIEW as
    select * from OTHER_VIEW@SOMELINK
    alter view SOME_VIEW add constraint PK_SOME_VIEW
    PRIMARY KEY (pkey1)
    DISABLE NOVALIDATE;
    The problem is if I try to include rownum in the query in the report I always get:
    failed to parse SQL query:
    ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc.
    There's no rowid, it knows that the primary key is Pkey1 so what is the problem?
    I know it's rownum that it hates. Maybe I can just number these things some other
    way. However it'd be good to figure out what it is griping about.
    Anyone know?
    Edited by: lake on Mar 12, 2011 9:36 AM

    thanks!
    Actually I made a mistake in testing. And it does work to do this:
    in database1:
    create or replace view VIEW1 as
    select
    rownum "SEQ", etc.
    in database2:
    create view VIEW2 as select * from VIEW1@mylink
    How I screwed up testing that I don't know. I was calling the column NUM before....
    this is good because you can create a report about the next so many of something, such as how many of
    the next batch of mailings have address problems? For that you need to know in what order it will be done and
    when to quit.
    But I'm sure I will use the report rownum thing also. thanks very much.

  • Running a query in a View Designer results in an error, but running the same query in a Query window works

    Hi everyone,
    Just as my title says, I have a query which I've written in a query window and it works perfectly.
    But when I try to add the query code into the view designer, it throws a Syntax error.
    Error in ON clause near '('.Unable to parse query text.
    Also, when running the query from the view designer (pressing red exclamation mark) I get a different error.
    SQL Execution Error.Executed SQL statement: SELECT Sku, ParentSku, UPC, ...Error Source: .Net SqlClient Data ProviderError Message: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
    Has anyone else experienced this and is there any workaround?
    I have tried to create the view with T-SQL (CREATE VIEW etc.), but when opening it in the view designer I get the error from the 1st image.
    Thank you,
    Radu

    Hi Radu,
    Yes, I have faced similar issue. I had a View and it was working totally fine but when once I opened it in via right click - View Design, it was giving parse error.
    Cause is that Query designer parse and executes the query without error but the way View designer works, it can't parse it.
    Later I ignored View desinger and just used T-SQL like CREATE/ALTER view.
    Workaround is to do right click on View - Script View as - CREATE To/ ATER To.
    Regarding Timeout error, again the issue with View designer which couldn't execute query in there and ended up with timeout error.
    If your SELECT query and SELECT * FROM YourView works fine in Query designer, you are good to go.
    Similar threads:
    View with errors still saved, and still works...
    Parsing error when creating view
    -Vaibhav Chaudhari

  • Problem in view

    if i have view like
    create or replace view v_emp as (select * from emp);
    and now i drop one column from emp; i.e View become invalid
    how this view become valid 'I already tried alter view v_emp compile but return error

    You need to understand how oracle stores the view definition.
    SQL> create table test (col1 varchar2(2),col2 number(2), col3 char(1));
    Table created.
    SQL> create view test_view as select * from test;
    View created.Lets see the definition stored by oracle.
    SQL> ed
    Wrote file afiedt.buf
      1* select view_name,text from user_views where view_name='TEST_VIEW'
    SQL> /
    VIEW_NAME                      TEXT
    TEST_VIEW                      select "COL1","COL2","COL3" from testSo, even you have created with *, oracle stored it with all column names like "SELECT COL1,COL2.." not "SELECT
    * FROM TEST"
    Now if you drop a column then this will become invalid and recompilation will not work because the col you dropped is still exists in the view definition.
    SQL> alter table test drop column col3;
    Table altered.
    SQL> select view_name,text from user_views where view_name='TEST_VIEW';
    VIEW_NAME                      TEXT
    TEST_VIEW                      select "COL1","COL2","COL3" from testBut if you add a column, then the view become invalid but the definition remains correct, So you can recompile that with ALTER command.

  • Using VIEW inside a stored procedure

    Hi,
    So I have a View designed in one file that validates someone who is authorized.
    Then I have a stored procedure to display authorized stationeries created before a given date. Its takes a parameter @CreatedOn.
    How can I use VIEW in my stored procedure so I can display all the authorized which are set 1 before a given date?
    My VIEW:
    ALTER VIEW vw_AuthorizedStationeries AS
    SELECT Authorized
    FROM dbo.Stationeries
    WHERE Authorized = 1
    And my stored procedure:
    CREATE PROCEDURE usp_stationeries (@CreatedOn datetime)ASBEGINSELECTFROMENDGO
    Thanks!

    Try something like below, You need to replace CreatedDate column with appropriate date column in your table.
    1. Alter the view to get the required date:
    ALTER VIEW vw_AuthorizedStationeries AS
    SELECT Authorized, CreatedDate
    FROM dbo.Stationeries
    WHERE Authorized = 1
    2. Alter SP:
    CREATE PROCEDURE usp_stationeries (@CreatedOn datetime)
    AS
    BEGIN
    SELECT Authorized
    FROM vw_AuthorizedStationeries
    WHERE CreatedDate <= @CreatedOn
    END
    GO
    OR
    You can pull required information directly from your table:
    CREATE PROCEDURE usp_stationeries (@CreatedOn datetime)
    AS
    BEGIN
    SELECT Authorized
    FROM dbo.Stationeries
    WHERE CreatedDate <= @CreatedOn and Authorized = 1
    END
    GO
    If this post answers your query, please click "Mark As Answer" or "Vote as Helpful".

  • Bug: Views Disappears

    I discovered quite by accident something kind of scary.
    If a view is edited through Portal (3.0.8), and there is a
    syntax problem, the view disappears.
    Here is what I was presented with:
    ORA-24344: success with compilation error(WWV-112301)
    Error: Invalid SQL statement or you do not have privileges to
    select from the Table/View (WWV-17138)
    I will stick to other means to modify views.
    Allan Thornton
    ThinkSpark Austin

    Hi,
    This is the way ALTER view is implemented in Portal.
    Whenever you try to Edit a View, the old view gets dropped
    and the new one is Created.
    While Editing a View you must be careful to click on the Back
    link on the error page to correct the view definition,
    If you click on the return to Navigator, the original View
    diappears.
    This is also the case with most other Database Objects.
    Thanks
    Vineet

Maybe you are looking for

  • Sending e-mail attachments with utl_mail.

    Hello guys i would like to add an attachment to an e-mail using utl_mail I have gotten this part done without a problem. My problem now is that i have to loop a table and make the contents of the table an attachment to the e-mail. So here is what i h

  • Missing audio....sometimes

    Audio works fine when I access Netflix or Youtube videos, but when I view friends' videos on Facebook or via links I don't hear audio. Any ideas? 

  • AS3 Project in Flash Builder

    Hi I am an experienced AS3 developer working on a Mac, been working in the CS4 IDE and using Textmate for html, PHP etc. I am very keen to use Flash Builder IDE to build my AS3 projects. I have been able to create actionscript projects but when I try

  • Dreamweaver sync issues

    Having issues with ftp sync in dreamweaver. I was wondering if anyone has gone ahead and deleted the various "dwsync.xml" files located in the _notes folders created by dreamweaver. I'm hoping this will stop some issues currently occuring when upload

  • After installing Photoshop CC (2014), do I need to sign out of Photoshop CC before I uninstall it.

    I recently installed Photoshop CC (2014) on my computer and no longer need to have Photoshop CC installed on it.  Do I need to sign out of the CC version before I uninstall it?