You must Sign In to post a response.
  • Category: SQL Server

    Record insert and the select in Oracle

    Here i have a select query and on the basis of where condition record are fecthing from the database & show in the DropDown list.
    Now I want add new specific Item in the DropDown List in the end (Allocated on Basis of round), how i can do it in the database.

    Means After Select Query Recodrs Fetch From database, insert into this record at the end. how i can write query firstly record insert then select all record.

    SELECT LUD_USER_ID "CODE",
    LUD_USER_NAME "DESCRIPTION"
    FROM LMS_USER_DETAILS
    WHERE LUD_LEVEL = 'T4' AND LUD_STATUS = 'A' AND LUD_COMPANY = 'ISL' AND LUD_REPORTING_HEAD = PI_DEPENDENTARGUMENT2
    ORDER BY LUD_USER_ID;
  • #769096
    Hi nitin
    Do you want to add another set of records or simply " Select all " word.
    You can achieve by using "UNION ALL"

    SELECT LUD_USER_ID "CODE",
    LUD_USER_NAME "DESCRIPTION"
    FROM LMS_USER_DETAILS
    WHERE LUD_LEVEL = 'T4' AND LUD_STATUS = 'A'
    AND LUD_COMPANY = 'ISL'
    AND LUD_REPORTING_HEAD = PI_DEPENDENTARGUMENT2

    UNION ALL
    SELECT 0 "CODE",'SELECT ALL' "DESCRIPTION" FROM DUAL
    ORDER BY LUD_USER_ID;

    If you want to use another Query replace the select query after UNION ALL by your requirement.
    I Hope it will help you, Otherwise Elaborate more on what you want.

  • #769119
    The INSERT INTO SELECT statement copies data from one table and inserts data into another table. Here is the Query to Record insert and the select in Oracle
    INSERT INTO table2 (column1, column2, column3, ...)
    SELECT column1, column2, column3, ...
    FROM table1
    WHERE condition;

    Useful Reference : https://www.w3schools.com/sql/sql_insert_into_select.asp


  • Sign In to post your comments