Sign Up

Sign Up to our social questions and Answers to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In
Continue with Google
or use


Have an account? Sign In Now

Sign In

Login to our social questions & Answers to ask questions, answer people’s questions & connect with other people.

Sign Up Here
Continue with Google
or use

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Continue with Google
or use

Forgot Password?

Need An Account, Sign Up Here

Sorry, you do not have permission to add post.

Continue with Google
or use

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Oraask Logo Oraask Logo
Sign InSign Up

Oraask

  • Write
    • Add A New Post
    • Ask A Question

Oraask Navigation

Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Categories
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Dev Tools
    • Online Compiler
    • Base64 Converter
    • Oraask XML Formatter
    • Oraask JSON Formatter
  • Wiki
    • SQL Tutorials
    • Java Tutorials
    • Python Tutorials
    • JavaScript Tutorials

Database

This Category lists all questions related to all different kind of databases

Share
  • Facebook
0 Followers
0 Answers
150 Questions
Home/Database/Page 4
  • Recent Questions
  • Answers
  • No Answers
  1. Asked: April 30, 2017In: PL/SQL

    What is the difference between binary_integer and pls_integer in pl/sql?

    Googler
    Googler Explorer
    Added an answer on September 19, 2018 at 8:10 am

    Hi, binary_integer and pls_integer both are same. Both are PL/SQL datatypes with range -2,147,648,467 to 2,147,648,467. Compared to integer and binary_integer pls_integer very fast in excution. Because pls_intger operates on machine arithmetic and binary_integer operes on library arithmetic. pls_intRead more

    Hi,

    binary_integer and pls_integer both are same. Both are PL/SQL datatypes with range -2,147,648,467 to 2,147,648,467.

    Compared to integer and binary_integer pls_integer very fast in excution. Because pls_intger operates on machine arithmetic and binary_integer operes on library arithmetic.

    pls_integer comes from oracle10g.

    binary_integer allows indexing integer for assocative arrays prior to oracle9i.

    See less
      • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
  2. Asked: May 2, 2017In: Oracle SQL

    ORA-12015: cannot create a fast refresh materialized view from a complex query

    Hassan AbdElrahman
    Hassan AbdElrahman Master Oracle ACE Pro Alum ♠ | Oracle Senior ERP Technical Consultant
    Added an answer on September 8, 2018 at 8:49 pm

    Hello Albert, generally this the explanation for that error : ORA-12015: cannot create a fast refresh materialized view from a complex query Cause: Neither ROWIDs and nor primary key constraints are supported for complex queries. Action: Reissue the command with the REFRESH FORCE or REFRESH COMPLETERead more

    Hello Albert,

    generally this the explanation for that error :

    ORA-12015: cannot create a fast refresh materialized view from a complex query
    Cause: Neither ROWIDs and nor primary key constraints are supported for complex queries.
    Action: Reissue the command with the REFRESH FORCE or REFRESH COMPLETE option or create a simple
    materialized view.

    also to Diagnosing ORA-12015 fast refresh materialized view / complex queries that’s depend on the database version there is some restrictions ex:

      Oracle10g – 10.2
    ——————–

    Fast refreshable materialized views must be based on master tables, master materialized views, or synonyms of master tables
    or master materialized views. Complete refresh must be used for a materialized view based on a view.

     

    for further details about diagnosing refer to : Note.179466.1

    hope this helpful.

    See less
      • -1
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
  3. Asked: April 30, 2017In: Oracle SQL

    How to remove duplicate rows by where condition ?

    Hassan AbdElrahman
    Hassan AbdElrahman Master Oracle ACE Pro Alum ♠ | Oracle Senior ERP Technical Consultant
    Added an answer on April 13, 2018 at 10:18 pm

    you can use : [code] SELECT * FROM test_table WHERE number_col NOT IN (SELECT number_col FROM test_table GROUP BY number_col HAVING count (*) > 1) [/code]

    you can use :

    [code]
    SELECT *
    FROM test_table
    WHERE number_col NOT IN (SELECT number_col
    FROM test_table
    GROUP BY number_col
    HAVING count (*) > 1)
    [/code]

    See less
      • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
  4. Asked: March 10, 2017In: Oracle SQL

    How to return N of rows after ordering in oracle sql ?

    Hassan AbdElrahman
    Hassan AbdElrahman Master Oracle ACE Pro Alum ♠ | Oracle Senior ERP Technical Consultant
    Added an answer on April 4, 2018 at 9:22 pm

    You can use a subquery for this like [code] select * from ( select * from emp order by sal desc ) where ROWNUM <= 5; [/code] Starting from Oracle 12c R1 (12.1). there is a syntax available to limit rows or start at offsets (full syntax here) example : [code] SELECT * FROM employees ORDER BY salarRead more

    You can use a subquery for this like

    [code]
    select *
    from
    ( select *
    from emp
    order by sal desc )
    where ROWNUM <= 5;
    [/code]

    Starting from Oracle 12c R1 (12.1). there is a syntax available to limit rows or start at offsets (full syntax here)

    example :

    [code]
    SELECT *
    FROM employees
    ORDER BY salary
    OFFSET 20 ROWS FETCH NEXT 10 ROWS ONLY;
    [/code]

    hope this helpful 🙂

    See less
      • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
  5. Asked: July 14, 2017In: Oracle SQL

    How dbms_assert protects against SQL injection ?

    Hassan AbdElrahman
    Hassan AbdElrahman Master Oracle ACE Pro Alum ♠ | Oracle Senior ERP Technical Consultant
    Added an answer on April 3, 2018 at 10:00 pm

    The dbms_assert package is used in databases that don't employ bind variables to help prevent SQL injection attacks, by "sanitizing" the SQL. it has several procedures inside ex : simple_sql_name: Validates the syntax of the SQL to ensure that the SQL statement only contains valid characters and proRead more

    The dbms_assert package is used in databases that don’t employ bind variables to help prevent SQL injection attacks, by “sanitizing” the SQL.

    it has several procedures inside ex :

    • simple_sql_name: Validates the syntax of the SQL to ensure that the SQL statement only contains valid characters and proper quotes around internal values.
    • schema_name: Allows you to validate a schema name against the dictionary

    and this a simple example of using (dbms_assert.simple_sql_name)

    [code]CREATE OR REPLACE PROCEDURE oraask_test (tbl_name VARCHAR2, col_name VARCHAR2)
    IS
    qry VARCHAR2 (500);
    BEGIN
    qry := ‘ALTER TABLE ‘ || dbms_assert.simple_sql_name ( :tbl_name) || ‘ ADD ‘ || :col_name || char (1);

    EXECUTE IMMEDIATE qry USING col_name;
    END oraask_test;[/code]

    See less
      • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
  6. Asked: April 1, 2017In: Oracle SQL

    Can i INSERT or UPDATE a table through a view ?

    Hassan AbdElrahman
    Hassan AbdElrahman Master Oracle ACE Pro Alum ♠ | Oracle Senior ERP Technical Consultant
    Added an answer on April 1, 2018 at 9:14 pm

    Hello Beter, Views in Oracle may be updateable under specific conditions. It can be tricky, and usually is not advisable. From the Oracle 10g SQL Reference: Notes on Updatable Views An updatable view is one you can use to insert, update, or delete base table rows. You can create a view to be inherenRead more

    Hello Beter,

    Views in Oracle may be updateable under specific conditions. It can be tricky, and usually is not advisable.

    From the Oracle 10g SQL Reference:

    Notes on Updatable Views

    An updatable view is one you can use to insert, update, or delete base table rows. You can create a view to be inherently updatable, or you can create an INSTEAD OF trigger on any view to make it updatable.

    To learn whether and in what ways the columns of an inherently updatable view can be modified, query the USER_UPDATABLE_COLUMNS data dictionary view. The information displayed by this view is meaningful only for inherently updatable views. For a view to be inherently updatable, the following conditions must be met:

    • Each column in the view must map to a column of a single table. For example, if a view column maps to the output of a TABLE clause (an unnested collection), then the view is not inherently updatable.
    • The view must not contain any of the following constructs:
    1. A set operator
    2. a DISTINCT operator
    3. An aggregate or analytic function
    4. A GROUP BY, ORDER BY, MODEL, CONNECT BY, or START WITH clause
    5. A collection expression in a SELECT list
    6. A subquery in a SELECT list
    7. A subquery designated WITH READ ONLY
    8. Joins, with some exceptions, as documented in Oracle Database Administrator’s Guide

    In addition, if an inherently updatable view contains pseudocolumns or expressions, then you cannot update base table rows with an UPDATE statement that refers to any of these pseudocolumns or expressions.

    If you want a join view to be updatable, then all of the following conditions must be true:

    • The DML statement must affect only one table underlying the join.
    • For an INSERT statement, the view must not be created WITH CHECK OPTION, and all columns into which values are inserted must come from a key-preserved table. A key-preserved table is one for which every primary key or unique key value in the base table is also unique in the join view.
    • For an UPDATE statement, all columns updated must be extracted from a key-preserved table. If the view was created WITH CHECK OPTION, then join columns and columns taken from tables that are referenced more than once in the view must be shielded from UPDATE.
    • For a DELETE statement, if the join results in more than one key-preserved table, then Oracle Database deletes from the first table named in the FROM clause, whether or not the view was created WITH CHECK OPTION.
    See less
      • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
  7. Asked: April 30, 2017In: Oracle SQL

    Can I use If statement inside Where clause in oracle SQL?

    Hassan AbdElrahman
    Hassan AbdElrahman Master Oracle ACE Pro Alum ♠ | Oracle Senior ERP Technical Consultant
    Added an answer on April 1, 2018 at 8:54 pm

    hello oracle user, you can use CASE statement same like IF ex: [code] WHERE e.status = (CASE WHEN status_flag = STATUS_ACTIVE THEN 'A' WHEN status_flag = STATUS_INACTIVE THEN 'T' ELSE null END) AND e.business_unit = (CASE WHEN source_flag = SOURCE_FUNCTION THEN 'production' WHEN source_flag = SOURCERead more

    hello oracle user,

    you can use CASE statement same like IF ex:

    [code]
    WHERE e.status = (CASE WHEN status_flag = STATUS_ACTIVE THEN ‘A’
    WHEN status_flag = STATUS_INACTIVE THEN ‘T’
    ELSE null END)
    AND e.business_unit = (CASE WHEN source_flag = SOURCE_FUNCTION THEN ‘production’
    WHEN source_flag = SOURCE_USER THEN ‘users’
    ELSE null END)
    [/code]

    See less
      • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
  8. Asked: April 30, 2017In: PL/SQL

    How to handle a unique constraint exceptions in PL/SQL code?

    Hassan AbdElrahman
    Hassan AbdElrahman Master Oracle ACE Pro Alum ♠ | Oracle Senior ERP Technical Consultant
    Added an answer on April 1, 2018 at 8:50 pm

    hello, you can use exception : [code] EXCEPTION WHEN DUP_VAL_ON_INDEX [/code]

    hello,

    you can use exception :

    [code]
    EXCEPTION
    WHEN DUP_VAL_ON_INDEX
    [/code]

    See less
      • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
  9. Asked: March 29, 2018In: Oracle SQL

    How to rollback oracle sequence value ?

    Hassan AbdElrahman
    Hassan AbdElrahman Master Oracle ACE Pro Alum ♠ | Oracle Senior ERP Technical Consultant
    Added an answer on March 29, 2018 at 9:35 pm

    There is no way to rollback the generated sequence. To restart the sequence at a different number, you must drop and re-create it. See http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_2011.htm. If you change the INCREMENT BY value before the first invocation of NEXTVAL, some sequenceRead more

    There is no way to rollback the generated sequence.

    To restart the sequence at a different number, you must drop and re-create it. See http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_2011.htm.

    If you change the INCREMENT BY value before the first invocation of NEXTVAL, some sequence numbers will be skipped. Therefore, if you want to retain the original START WITH value, you must drop the sequence and re-create it with the original START WITH value and the new INCREMENT BY value.

    See less
      • 1
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
  10. Asked: March 3, 2017In: Oracle SQL

    what is the difference between “INNER JOIN” and “OUTER JOIN”?

    albert
    albert Explorer
    Added an answer on August 23, 2017 at 1:40 pm

    Hi there,i found some answer you will understand it so easy.Assuming you're joining on columns with no duplicates, which is a very common case:An inner join of A and B gives the result of A intersect B, i.e. the inner part of a Venn diagram intersection.An outer join of A and B gives the results ofRead more

    Hi there,

    i found some answer you will understand it so easy.

    Assuming you’re joining on columns with no duplicates, which is a very common case:

    An inner join of A and B gives the result of A intersect B, i.e. the inner part of a Venn diagram intersection.

    An outer join of A and B gives the results of A union B, i.e. the outer parts of a Venn diagram union.

    Examples

    Suppose you have two tables, with a single column each, and data as follows:

    A B
    – –
    1 3
    2 4
    3 5
    4 6

    Note that (1,2) are unique to A, (3,4) are common, and (5,6) are unique to B.

    Inner join

    An inner join using either of the equivalent queries gives the intersection of the two tables, i.e. the two rows they have in common.

     

    [code]SELECT *
    FROM a INNER JOIN b ON a.a = b.b;[/code]

    [code]SELECT a.*, b.*
    FROM a, b
    WHERE a.a = b.b;[/code]

    a | b
    –+–
    3 | 3
    4 | 4

    Left outer join

    A left outer join will give all rows in A, plus any common rows in B.

    [code]select * from a LEFT OUTER JOIN b on a.a = b.b;
    select a.*,b.* from a,b where a.a = b.b(+);[/code]

    a | b
    –+—–
    1 | null
    2 | null
    3 | 3
    4 | 4

    Right outer join

    A right outer join will give all rows in B, plus any common rows in A.

    [code]select * from a RIGHT OUTER JOIN b on a.a = b.b;
    select a.*,b.* from a,b where a.a(+) = b.b;[/code]

    a | b
    —–+—-
    3 | 3
    4 | 4
    null | 5
    null | 6

    Full outer join

    A full outer join will give you the union of A and B, i.e. all the rows in A and all the rows in B. If something in A doesn’t have a corresponding datum in B, then the B portion is null, and vice versa.

    [code]select * from a FULL OUTER JOIN b on a.a = b.b;[/code]

    a | b
    —–+—–
    1 | null
    2 | null
    3 | 3
    4 | 4
    null | 6
    null | 5

    See less
      • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
1 2 3 4 5 6 … 9

Sidebar

Adv 250x250

Explore

  • Categories
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Dev Tools
    • Online Compiler
    • Base64 Converter
    • Oraask XML Formatter
    • Oraask JSON Formatter
  • Wiki
    • SQL Tutorials
    • Java Tutorials
    • Python Tutorials
    • JavaScript Tutorials

Footer

Oraask

About

Oraask is a website for developers and software engineers who want to learn new skills, share their knowledge, and solve their coding problems. Oraask provides free content on various programming languages and topics, such as Oracle, Python, Java, etc. Oraask also allows users to ask questions and get answers from other members of the community.

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy
  • Terms & Conditions

Follow

Oraask is licensed under CC BY-NC-SA 4.0Oraask CopyrightOraask CopyrightOraask CopyrightOraask Copyright

© 2019 Oraask. All Rights Reserved
With Love by Oraask.