Reg: Creation of a View

Hi All,
I have a requirement like creating a view with deptno and employee information like below. How to create a view to get the result set in the below fromat.
DEPTNO   EMPNO   ENAME    JOB
10             7788        SMITH      CLERK
                7369        JAMES     MANAGER
                7123        CLARK     CLERK
20            1234         ABCD       SALESMAN
Thanks,

971220 wrote:
Hi All,
I have a requirement like creating a view with deptno and employee information like below. How to create a view to get the result set in the below fromat.
DEPTNO   EMPNO   ENAME    JOB
10             7788        SMITH      CLERK
                7369        JAMES     MANAGER
                7123        CLARK     CLERK
20            1234         ABCD       SALESMAN
Thanks,
Hi ,
Try this
{code}
SQL> with test_data as
  2  (
  3  select 10 dept_no,7798 emp_no,'SMITH' ENAME,'CLERK' AS JOB
  4  from dual
  5  UNION ALL
  6  SELECT 10,7769,'JAMES','MANAGER' FROM dual
  7  UNION ALL
  8  SELECT 10,7123,'CLARK','CLERK' from dual UNION ALL
  9  SELECT 20,1234,'ABCD','SALESMAN' from dual
10  )
11  select  (case when rn=1 then dept_no END) AS dept_no,emp_no,ename,job
12  from (
13  select dept_no,
14  emp_no,
15  ename,
16  job,
17  row_number() over (partition by dept_no ORDER BY emp_no) rn  from test_data)
18 
SQL> .
SQL> /
{code}
Output:
{code}
SQL> /
   DEPT_NO     EMP_NO ENAME JOB
        10       7123 CLARK CLERK
                 7769 JAMES MANAGER
                 7798 SMITH CLERK
        20       1234 ABCD  SALESMAN
SQL>
{code}
Create view on top of the above query
{code}
CREATE view test_vw as ...above select query
{code}
Hope this helps
Regards,
Achyut Kotekal

Similar Messages

  • Creation of Column view for Multiprovider failed

    Dear Experts,
    I'm facing an issue in TR import.
    The TR failed with the below error message.
    Creation of column view for XXXXX failed.
    XXXXX - Multiprovider
    System :BW on HANA (BW 7.4 SP06)
    If there's a way to resolve this error, please let me know.
    Appreciate your help.
    Br, Harish

    Hi,
    Here's the workaround I have implemented for this issue.
    Implemented the note 1955263 and made the below correction to the programSAP_RSADMIN_MAINTAIN.
    Object = MPRO_CS_GEN_ERROR_IGNORE
    Value = X
    After the above customizations are done, TRs are imported without any issues.
    For the OSS message I have raised, SAP has asked us to implement the note 2001969 to fix the issue.
    Br, Harish

  • Creation of Materialized view and Materialized view log.

    I wanted to create materialized view with 'REFRESH FAST ON COMMIT' option.
    1) Table1 --it is partitioned range + list -- Added primary key
    2) view1   -- having primary keys on view's base table
    Steps:
    1) create materialized view log on Table1 ; -- default primary key
    2) create materialized view log on view1.  --- It is giving below error.
    ORA-00942: table or view does not exist
    i wanted to create Materialized view like below
    create materialized view
    REFRESH fast ON commit
    as
    select ...
    ... from table1
    where c1 in (select c1 from view1 where ... );
    Question:
    1) As i am getting above error while creating MV log on view. Can we create MV log on view or we have to create MV log on view base table?
    2) To create MV with ''REFRESH FAST ON COMMIT' option , do we need to have primary key on master tables? 
    Any pointers on this will really helpful.
    Thanks
    Prasad

    Also created MV LOG on 3 tables and tried with joins ..
    create materialized view
    REFRESH fast ON commit
    as
    select ...
    ... from table1 , tab2 t2,tab3 t3
    where ....
    and ...
    Get same error ORA-12052: cannot fast refresh materialized view AVSYS.EVENT_LOG_MV
    2052. 00000 -  "cannot fast refresh materialized view %s.%s"
    *Cause:    Either ROWIDs of certain tables were missing in the definition or
               the inner table of an outer join did not have UNIQUE constraints on
               join columns.
    *Action:   Specify the FORCE or COMPLETE option. If this error is got
               during creation, the materialized view definition may have be
               changed. Refer to the documentation on materialized views.

  • Creation of materialized view

    Hi All,
    We had created some other materialized view with for small set of data. The materialized view name is ‘XXCA_PAGL_RECON_GL1_TRANS_MV’ and it has created a table with the same name.
    What I am unable to understand is that the new table which was created by the system during the creation of materialized view is in VALID state but the materialized view is in INVALID state.
    Please help me to understand this process.
    Thanks in advance
    Venkatesh

    The column dba_objects.status for mviews is set to INVALID when the base tables are updated. See Metalink note 454552.1. It is normal.
    Edited by: YasinBaskan on Feb 17, 2009 2:07 PM

  • Reg: Creation of PFILE

    Hi
    I'm a fresh DBA.I'm new to this field and learning Things.Unknowingly i deleted the pfile and made a shutdown to my database..... When i'm trying to start the Database i'm unable to start it. is there any way to create a new pfile..........Please find me the way...
    Advance Thanks
    S.Ram

    Hi,
    What is your Oracle version ? Have you create a spfile before delete pfile ? If the response is no, you need to recreate a pfile manually.
    => It a good way to have a backup of all database files, including pfile (or spfile).
    Nicolas.
    Duplicate case with thread in other forum :
    Re: Reg: Creation of PFILE after DB Shutdown
    Message was edited by:
    N. Gasparotto

  • Reg: Creation of PFILE after DB Shutdown

    Hi
    Actually i deleted the pfile accidentally and shutdown my database..... is there any way to create a new pfile..........Please find me the way...

    Duplicate case with thread in other forum :
    Reg: Creation of PFILE
    Choose a forum and fix it.
    What is your Oracle version ? Have you create a spfile before delete pfile ? If the response is no, you need to recreate a pfile manually.
    => It a good way to have a backup of all database files, including pfile (or spfile).
    Nicolas.

  • Report Creation with Qucik Viewer(SQVI)

    Hi
    My client requirement is to get the CSO  report on the  items which are invoiced and the items are not invoiced in the CSO.
    i though i could generate the intended report wiht Quick Viewer (SQVI)
    kindly advise me how do i proceed with this kind of report.
    Regards
    TharakJReddy

    Your application is referencing the file craxDDrt.dll. In order to use this dll, you needed to obtain extra licensing. Since CR 10 has been out of support for over 5(?) years, I am not sure if you can still obtain the licensing. Contact sales at 866-681-3435 to find out.
    Alternatively, reference the craxDrt.dll. This dll does not require any extra licensing. However, the error you are getting indicates that you are using Report Creation APIs (RCAPI) from craxDDrt.dll. In my experience, there often were other ways of coding to achieve the same thing with craxdrt.dll. Let me know what RCAPIs you are using and I may be able to help out there.
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

  • Long time for creation of materialized view

    Hi,
    we are trying to create a materialized view and this view would contain 1 lakh records and around 50 columns.
    The select statement to get these records takes only 1-2 sec whereas the actual creation of view takes 17 minutes. The database used is Oracle 8i. The code used is
    CREATE MATERIALIZED VIEW employee_master_t
    PCTFREE 10
    STORAGE (initial 500k next 500k pctincrease 0)
    REFRESH WITH ROWID COMPLETE START WITH SYSDATE
    NEXT SYSDATE + 1 AS select * from table_name
    Is it because the insert is slow and temp tablespace may have to be increased?
    also, can anyone pls suggest if fast refresh mode can be used with Oracle 8i since currently we are not able to create as error saying that query is complex is returned

    It will be possible to create a Materialised view with up to 20 tables, but you have to understand the restrictions on complex Materialised views with regards to fast refresh.
    To help your understanding, refer to Materialized View Concepts and Architecture
    <br>
    Oracle Database FAQs
    </br>

  • Error on creation of a view

    i have a norma view like this
    CREATE FORCE VIEW USERBO.USERPROFILE_VIEW
    (ROW_ID,EMPLOYEE,RESPONSABILITY_ID,RUOLO,E_USERNAME,E_PASSWORD,USERTYPE,USER_ID) AS
    SELECT RESPONSABILITYUSER.row_id,
    client.surname
    || ' '
    || client.NAME,
    RESPONSABILITYUSER.responsability_id,
    'USERWEB',
    upper(client.username) || '-' || client.organization_id,
    client.pwd,
    client.usertype,
    client.ROW_ID
    FROM RESPONSABILITYUSER,
    general.client
    WHERE ((client.row_id = RESPONSABILITYUSER.user_id))
    AND client.status ='ACTIVE'
    the select works fine but the view
    was create with "error"
    but how i can find the essror ??
    i tried "show error" but no error found
    insten when i create the view occur an error of creation and dos not work !!
    Help

    >
    the strange is that the select extract from the view and execute from user USERBO
    works without errors and the two USER (USERBO AND CLIENT) are dba users.
    >
    Why is that strange? The common way to make a user a DBA is to grant them the DBA role.
    Reread my reply above. Especially this part
    >
    the user creating the view has to have select privileges on the RESPONSABILITYUSER table granted directly to them.
    >
    To work in a view or pl/sql procedure/function/package privileges must be 'GRANTED DIRECTLY TO THEM'!
    Repeat after me:
    DBA is a role, roles are not active in views/procedures/functions/packages: privileges must be 'GRANTED DIRECTLY TO THEM'!
    DBA is a role, roles are not active in views/procedures/functions/packages: privileges must be 'GRANTED DIRECTLY TO THEM'!
    DBA is a role, roles are not active in views/procedures/functions/packages: privileges must be 'GRANTED DIRECTLY TO THEM'!
    DBA is a role, roles are not active in views/procedures/functions/packages: privileges must be 'GRANTED DIRECTLY TO THEM'!
    DBA is a role, roles are not active in views/procedures/functions/packages: privileges must be 'GRANTED DIRECTLY TO THEM'!
    Now please post the answer to this question:
    >
    I must grant select on all tables ??

  • Error:While creation of Classification view using-'BAPI_OBJCL_CREATE'

    Hi all,
    I am using function module -
    CALL FUNCTION 'BAPI_OBJCL_CREATE'
      EXPORTING
        OBJECTKEYNEW            = OBJECTKEYNEW1
        OBJECTTABLENEW          = 'MARA'
        CLASSNUMNEW             = CLASSNUMNEW1
        CLASSTYPENEW            = CLASSTYPENEW1
      STATUS                  = '1'
      STANDARDCLASS           =
      CHANGENUMBER            =
      KEYDATE                 = SY-DATUM
      NO_DEFAULT_VALUES       = ' '
    IMPORTING
      CLASSIF_STATUS          =
      TABLES
      ALLOCVALUESNUM          =
        ALLOCVALUESCHAR         = ALLOCVALUESCHAR1
      ALLOCVALUESCURR         =
        RETURN                  = RETURN1
    for creation of classification of material.But it gives me afollowin errors -
    1)Assignment does not exist or is not valid on
    2)Table   not supported for class type
    3)Assignment was not created
    in return table.
    Thanks.

    Hi,
      Please follow the below steps.
    Creating the Classification View using the Function module 'BAPI_OBJCL_CREATE'.
    Check the Class Type and Class Number which you are passing.
    Generally it will be Class type - 001 (Material Class) and Number will be ENGINEERING.
    It depends.
    But, what you can do is, Check material which has classification data filled.
    And just use the same class Type and Class Number Details.
    Try this way.It should work.
    To know the Available Class Types refer to table TCLA.
    Please let me know, if you want further help.
    Thanks & Regards,
    Vamsi.

  • Creation of Database View , Projection View

    Hi ABAP EXPERTS,
    Can anyone plz send me the step by step creation of DATABASE and PROJECT VIEWS. Just steps by step explanation will do , screen shots will be more than appreciated.
    Kind Regards,
    Sunil Ranal.

    Database View (SE11)
    Database views are implement an inner join, that is, only records of the primary table (selected via the join operation) for which the corresponding records of the secondary tables also exist are fetched. Inconsistencies between primary and secondary table could, therefore, lead to a reduced selection set. In database views, the join conditions can be formulated using equality relationships between any base fields. In the other types of view, they must be taken from existing foreign keys. That is, tables can only be collected in a maintenance or help view if they are linked to one another via foreign keys.
    Check this link for database view creation.
    http://help.sap.com/saphelp_40b/helpdata/en/cf/21ed06446011d189700000e8322d00/content.htm
    Projection View
    Projection views are used to suppress or mask certain fields in a table (projection), thus minimizing the number of interfaces. This means that only the data that is actually required is exchanged when the database is accessed. A projection view can draw upon only one table. Selection conditions cannot be specified for projection views.
    Check this link for Projection view creation.
    http://help.sap.com/saphelp_nw70/helpdata/en/cf/21ed20446011d189700000e8322d00/content.htm
    Regards,
    Maha

  • Reg: Creation of new Material type

    Hai Guys,
    Jino here,can anyone please tell me the procedure for creating my own "MATERIAL TYPE"
    while creating a new material.
    Regards
    Jino.

    Hi
    decide which material type in the standard availabilty closely resembles you New material Type  you are planning to create, It may be ROH/HALB/FERT/ERSA or any other. Use the TxN OMS2 for this, select the existing Std Material and do a Copy As and name the New material Type starting with Z . for example ZRAW , once saved select the material tyep and go to the details of the new material type , you can remove Certail views if you donot wish to have it during material creation, check out other parameters also lie external proc/internal proc, standard or Moving avg price indicator  and proceed as required for you.
    Regards

  • Blocking vendor for PO creation if Accounting view is not maintained.

    Hi ALl,
    Is it possible to restrict RFQ or PO creation against vendor if accounting view is not maintained by account dept.
    I dont want to block it in MK06 or XK06 or in source list.
    Is there any user exit for this?
    Pls guide.
    Regards.
    Edited by: sapsarang on Aug 5, 2011 10:07 AM

    Hi,
    Use BAdi "ME_PROCESS_PO_CUST" and write the code under Interface "PROCESS_HEADER".
    Following is the sample code for the same.
    data t_lifnr type lfb1-lifnr.
    if w_lifnr is not initial and wa_hdr-bukrs is not initial.
    select single lifnr from lfb1 into t_lifnr where lifnr = w_lifnr
                                 and bukrs = wa_hdr-bukrs.
       if sy-subrc ne 0.
         MESSAGE e025(zm01) WITH w_lifnr wa_hdr-bukrs.
       endif.
    Here create a message as ZM01025 (In TCode SE91) as "Vendor has not been maintained for Co. Code &."

  • Reg : Material warehouse management view 1 & 2

    Hello All,
    Using a Z-programI am extending the warehouse managemnt view for a single Plant, the view gets created successfully. But some how an Inactive version of Warehouse management view gets created for other plant also. How we can prevent the creation of this inactive view creation.
    Please let me know your suggestion.
    Regards,
    Ravi Kasale.

    from Note 545626 - FAQ: Data transfer problems:
    Read the explanations in OSS Note 67616.
    Bear in mind that, in the structure/table HEADDATA, the for BAPI methods StandardMaterial.SaveData (BAPI_MATERIAL_SAVEDATA) and StandardMaterial.SaveReplica (BAPI_MATERIAL_SAVEREPLICA) of the business object BUS1001006, you can select the required views and these correspond to the respective maintenance status.
    In the segment E1MARAM of the MATMAS IDocs, you can assign the overall maintenance status in the field VPSTA.
    Edited by: Jürgen L. on Jun 6, 2011 4:01 PM

  • Material creation for All VIEW using BAPI Function modules

    Dear All,
                 I want to create materials for all views using BAPI F.Ms. By using BAPI_MATERIAL_SAVEDATA i have extended materials for for only specified views. now my requirement is to create Material with All views including Classfication view also. For this i found BAPI_OBJCL_CREATEFM.
             Tell me that shall i use both Fm's at time to create material.Will it work? According to my knowledge we need to create Characters first ,then we should  assign this character to this class, then while creation of material we should select this class .
            so pls guide me the procedure to follow for both FM's .
    Note : Pls don't suggest me LSMW OR BDC procedure.
    regards,
    Prashanth Maturu.

    Hi prashanth,
    U can use both the FM. using BAPI_MATERIAL_SAVEDATA u can create all the views and for classification view use BAPI_OBJCL_CREATE. before assigning class to material u hve to make sure that the characteristics are uploaded and is attched to the class using transaction CL03.
    Regards,
    Anil N.

Maybe you are looking for

  • HELP! I had a duplicate contact added to my iPhone 1390 times!!!!

    I have an iPhone 3gs (yes, I'm still living in the past), I have multiple contacts that randomly get added to my list of contacts. "Random" because it is mostly not even people I contact at ALL, by email or phone. Some of the contacts are only people

  • Java JDK not working.

    Hello! I would like to program in Java on my new Arch Linux machine, but it doesn't seem to work. When I use the terminal javac works fine and compiles the file, but when I try running it with java, it does not work. Also, when one class calls anothe

  • IPhoto can't import RAW Images (HELP!!!)

    Since I updated My mac to the new Yosemite software, I can't seem to import any RAW images. It hangs and out of 100 images that im trying to import , only 2 are imported ( for half an hour ) and they are distorted I 've reinstalled it and still the s

  • How to convert excel data into OTF and FAX

    Hi All, We have a requirement where in we have a smartform output (OTF data) converted into PDF, and an excel sheet, both being sent as email attachments. Now, we need to send the content of both the attachments as FAX. Since smartform output was OTF

  • Missing type information when importing external web service

    Hello, using the SAP NetWeaver Developer Studio SAP NetWeaver 7.1 Composition Environment SP06 PAT0003, I have imported a number of RFCs from an R/3. The import succeeded as expected (see [here|http://img25.imageshack.us/my.php?image=importrfc.png])