Oracle SQL Developer
Oracle SQL Developer
Oracle SQL Developer
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Managing Views4.4 Managing Views4.3.3.4 Drop Indexes That Are No Longer RequiredYou might drop an index if:■■It does not speed up queries. The table might be very small, or there might bemany rows in the table but very few index entries.The queries in your applications do not use the index.■ The index must be dropped before being rebuilt.You cannot drop an index which is created through a constraint. You must drop theconstraint and then the index is dropped also.If you drop a table, then all associated indexes are dropped.To drop an index, the index must be contained in your schema or you must have theDROP ANY INDEX system privilege.Views are customized presentations of data in one or more tables or other views. Youcan think of them as stored queries. Views do not actually contain data, but insteadderive their data from the tables upon which they are based. These tables are referredto as the base tables of the view.Like tables, views can be queried, updated, inserted into, and deleted from, with somerestrictions. All operations performed on a view actually affect the base tables of theview. Views provide an additional level of security by restricting access to apredetermined set of rows and columns of a table. They also hide data complexity andstore complex queries.4.5 Managing SequencesA sequence is a database object similar to a pseudocolumn that generates uniquesequential values. These values are often used for primary and unique keys. Using asequence generator to provide the value for a primary key in a table is an easy way toguarantee that the key value is unique.You can refer to sequence values in <strong>SQL</strong> statements with these pseudocolumns:■CURRVAL: Returns the current value of a sequence■ NEXTVAL: Increments the sequence and returns the next valueYou must qualify CURRVAL and NEXTVAL with the name of the sequence, such asemployees_seq.CURRVAL or employees_seq.NEXTVAL.When you create a sequence, you can define its initial value and the incrementbetween its values. The first reference to NEXTVAL returns the initial value of thesequence. Subsequent references to NEXTVAL increment the sequence value by thedefined increment and return the new value. Any reference to CURRVAL alwaysreturns the current value of the sequence, which is the value returned by the lastreference to NEXTVAL.Before you use CURRVAL for a sequence in your session, you must first initialize thesequence with NEXTVAL.4-10 <strong>SQL</strong> <strong>Developer</strong> Online Help