ORACLE COMPICATED QUERY FROM 3 TABLES

i need to get a report from our oracle database 10g r2 have these info like this one:
    member_no, member_name, member_mobile_no, mb_membership_date, number of
    subscriptions for year 2009, total subscriptions months for the year 2009,
    number of subscriptions for year 2010, total subscriptions months for the year
    2010, number of subscriptions for year 2011, total subscriptions months for the
    year 2011, number of subscriptions for year 2012, total subscriptions months
    for the year 2012, number of subscriptions for year 2013, total subscriptions
    months for the year 2013, last subscription end date, last subscription payment
    type ,last subscription branch no
guys i have 3 tables as described below:
1-ft_subscriptions as :
    SU_SUB_NO NUMBER(12,0)
    SU_SUB_DATE DATE
    SU_BRANCH_NO VARCHAR2(10 BYTE)
    SU_MEMBER_NO VARCHAR2(12 BYTE)
    SU_SUB_STATUS CHAR(1 BYTE)
    SU_SUB_TYPE CHAR(1 BYTE)
    SU_SERVICE_NO NUMBER(5,0)
    SU_SERVICE_TYPE VARCHAR2(5 BYTE)
    SU_NO_OF_UNIT NUMBER(5,0)
    SU_START_DATE DATE
    SU_END_DATE DATE
    SU_PRICE_AMT NUMBER(13,2)
    SU_DISC_AMT NUMBER(13,2)
    SU_EXTRA_DISC NUMBER(13,2)
    SU_NET_AMT NUMBER(13,2)
    SU_GROUP_NO NUMBER(12,0)
    SU_PROM_OFFER_NO NUMBER(12,0)
    SU_UPGRADING_SUB_NO NUMBER(12,0)
    SU_SECOND_SUB_NO VARCHAR2(12 BYTE)
    SU_NOTES VARCHAR2(2000 BYTE)
    SU_COMMENTS1 VARCHAR2(2000 BYTE)
    SU_COMMENTS2 VARCHAR2(2000 BYTE)
    SU_CRE_DATE DATE
    SU_CRE_BY VARCHAR2(30 BYTE)
    SU_AVAIL_CPN NUMBER(4,0)
    SU_EXTRA_DISC_PCT NUMBER(6,3)
    SU_CREDIT_AMT NUMBER(13,2)
    SU_CUSTOMER_NO VARCHAR2(10 BYTE)
    SU_AUDITING_BY VARCHAR2(30 BYTE)
    SU_AUDITING_DATE DATE
    SU_AUDITING_NOTES VARCHAR2(2000 BYTE)
    SU_POSTED CHAR(1 BYTE)
    SU_ACTIVIATION_DATE DATE
    SU_NO_OF_MONTHS NUMBER(7,2)
    SU_ENTRYTIME_CODE NUMBER(5,0)
    SU_CATEGORY VARCHAR2(5 BYTE)
    SU_ACT_START_DATE DATE
    SU_ACT_END_DATE DATE
    SU_SECOND_BRANCH_NO VARCHAR2(3 BYTE)
    SU_ADMIN_DISC_EMP VARCHAR2(10 BYTE)
    SU_DISC_TYPE VARCHAR2(1 BYTE)
    SU_BRANCH_PRICE_FLAG VARCHAR2(1 BYTE)
    SU_MISSING_DATA_FLAG VARCHAR2(1 BYTE)
    SU_CREDIT_PCT NUMBER(6,3)
    SU_BONUS_DAYS NUMBER(5,0)
    SU_UNPS_TRANS_BRANCH VARCHAR2(3 BYTE)
    SU_UNPS_TRANS_SERIAL NUMBER(12,0)
    SU_UNPS_TRANS_DATE DATE
    SU_ALLOWED_TRANS VARCHAR2(1 BYTE)
    SU_PREVIOUS_BAL NUMBER(10,0)
    SU_CASHIER_BRANCH VARCHAR2(10 BYTE)
    SU_CASHIER_SERIAL NUMBER(12,0)
    SU_PAY_TYPE CHAR(1 BYTE)
    SU_OFFER_FREE_DAYS NUMBER(4,0)
    SU_DOCNO VARCHAR2(20 BYTE)
    SU_MSPNO VARCHAR2(20 BYTE)
    SU_DOCTYPE VARCHAR2(10 BYTE)
    SU_LOCNO VARCHAR2(10 BYTE)
    SU_DOC_PFX VARCHAR2(5 BYTE)
    SU_DOC_NO NUMBER(10,0)
    SU_MOD_BY VARCHAR2(30 BYTE)
    SU_MOD_DATE DATE
    SU_MEMBER_FRIEND VARCHAR2(12 BYTE)
    SU_OFFER_FREE_SERVICE NUMBER(5,0)
    SU_FRIEND_START_DATE DATE
2-ft_members as :
    MB_BUS_UNIT VARCHAR2(5 BYTE)
    MB_MEMBER_NO VARCHAR2(12 BYTE)
    MB_MEMBER_NAME VARCHAR2(60 BYTE)
    MB_MEMBER_STATUS CHAR(1 BYTE)
    MB_MEMBERSHIP_DATE DATE
    MB_MEMBER_BRANCH VARCHAR2(10 BYTE)
    MB_MEMBER_TYPE CHAR(1 BYTE)
    MB_MEMBER_NAT VARCHAR2(5 BYTE)
    MB_ID_TYPE NUMBER(3,0)
    MB_ID_NO VARCHAR2(15 BYTE)
    MB_ID_DATE DATE
    MB_BIRTH_DATE DATE
    MB_PHONE_NO VARCHAR2(15 BYTE)
    MB_MOBILE_NO VARCHAR2(15 BYTE)
    MB_POBOX NUMBER(10,0)
    MB_POSTAL_CODE VARCHAR2(25 BYTE)
    MB_ADDRESS VARCHAR2(2000 BYTE)
    MB_EMAIL VARCHAR2(100 BYTE)
    MB_CUSTOMER_NO VARCHAR2(10 BYTE)
    MB_EMP_NO VARCHAR2(15 BYTE)
    MB_MARKETTING_WAY CHAR(2 BYTE)
    MB_IMG VARCHAR2(350 BYTE)
    MB_NOTES VARCHAR2(2000 BYTE)
    MB_ACTIVE_NOTE VARCHAR2(2000 BYTE)
    MB_INACTIVE_NOTE VARCHAR2(2000 BYTE)
    MB_CRE_BY VARCHAR2(30 BYTE)
    MB_CRE_DATE DATE
    MB_VIA_MEMBER VARCHAR2(12 BYTE)
    MB_VIA_BRANCH VARCHAR2(10 BYTE)
    MB_VIA_SUB NUMBER(12,0)
    MB_ID_EXPIRY_DATE DATE
    MB_ID_DATE_HJ DATE
    MB_BIRTH_DATE_HJ DATE
    MB_ID_EXPIRY_DATE_HJ DATE
    MB_LANG VARCHAR2(1 BYTE)
    MB_JOB_TYPE NUMBER(10,0)
    MB_JOB_CLASS NUMBER(10,0)
    MB_JOB_PLACE NUMBER(10,0)
    MB_EMP_ID_EXPIRY_DATE DATE
    MB_EMP_ID_EXPIRY_DATE_HJ DATE
    MB_MEDIA_TYPE VARCHAR2(5 BYTE)
    MB_RELATIVE_MEMBER VARCHAR2(12 BYTE)
    MB_RELATIVE_EMP VARCHAR2(10 BYTE)
    MB_ID_COPY NUMBER(2,0)
    MB_ACQUIST_DISC_PCT NUMBER(6,3)
    MB_ACQUIST_DISC_TYPE VARCHAR2(1 BYTE)
    MB_ADDED_BONUS_FLAG VARCHAR2(1 BYTE)
    MB_REVIEW_SUB_NO NUMBER(12,0)
    MB_REVIEW_BRH_NO VARCHAR2(10 BYTE)
    MB_RECEIVED_SMS VARCHAR2(1 BYTE)
    MB_CARD_NO VARCHAR2(8 BYTE)
    MB_MOD_BY VARCHAR2(30 BYTE)
    MB_MOD_DATE DATE
    MB_MEMBER_NO7 VARCHAR2(12 BYTE)
    3-ft_services as :
    SRV_BUS_UNIT VARCHAR2(5 BYTE)
    SRV_SERVICE_NO NUMBER(5,0)
    SRV_SERVICE_DESC1 VARCHAR2(50 BYTE)
    SRV_SERVICE_DESC2  VARCHAR2(50 BYTE)
    SRV_SERVICE_TYPE VARCHAR2(5 BYTE)
    SRV_SERVICE_STATUS CHAR(1 BYTE)
    SRV_SERVICE_PRICE NUMBER(12,5)
    SRV_NO_OF_UNIT NUMBER(5,0)
    SRV_START_TIME NUMBER(7,0)
    SRV_END_TIME NUMBER(7,0)
    SRV_DURATION NUMBER(7,0)
    SRV_POINTS NUMBER(7,0)
    SRV_NOTES VARCHAR2(2000 BYTE)
    SRV_CRE_BY VARCHAR2(30 BYTE)
    SRV_CRE_DATE DATE
    SRV_MIN_PEND_DAYS NUMBER(3,0)
    SRV_MAX_PEND_DAYS NUMBER(3,0)
    SRV_MIN_EXT_DAYS NUMBER(3,0)
    SRV_MAX_EXT_DAYS NUMBER(3,0)
    SRV_BONUS_DAYS NUMBER(3,0)
    SRV_MAX_PEND_COUNT NUMBER(3,0)
    SRV_MAX_EXT_COUNT NUMBER(3,0)
    SRV_CATEGORY VARCHAR2(5 BYTE)
    SRV_EXTEND_DAYS NUMBER(3,0)
    SRV_NO_OF_MONTHS NUMBER(7,2)
    SRV_ENTRYTIME_CODE NUMBER(5,0)
    SRV_ALLOW_PERIOD NUMBER(5,0)
    SRV_RELATIVE_EMP_PCT NUMBER(6,3)
    SRV_RELATIVE_MBR_PCT NUMBER(6,3)
    SRV_DAYS_BEFORE_END NUMBER(3,0)
    SRV_DAYS_AFTER_END NUMBER(3,0)
    SRV_ALLOWED_WAIVE VARCHAR2(1 BYTE)
    SRV_ALLOWED_SUB_TRANS VARCHAR2(1 BYTE)
    SRV_UPGRADE_LIMIT NUMBER(4,0)
    SRV_MIN_AEG_ALLOWED NUMBER(5,2)
    SRV_MAX_AEG_ALLOWED NUMBER(5,2)
    SRV_WAIVE_LIMIT NUMBER(4,0)
    SRV_ALLOW_ACQUIRED_DISC VARCHAR2(1 BYTE)
i need to get a report  have these info like this one:
    member_no, member_name, member_mobile_no, mb_membership_date, number of
    subscriptions for year 2009, total subscriptions months for the year 2009,
    number of subscriptions for year 2010, total subscriptions months for the year
    2010, number of subscriptions for year 2011, total subscriptions months for the
    year 2011, number of subscriptions for year 2012, total subscriptions months
    for the year 2012, number of subscriptions for year 2013, total subscriptions
    months for the year 2013, last subscription end date, last subscription payment
    type ,last subscription branch no
guys this is very urgent for my company needs,thnx in advance

i need to get a report from our oracle database 10g r2 have these info like this one:
    member_no, member_name, member_mobile_no, mb_membership_date, number of
    subscriptions for year 2009, total subscriptions months for the year 2009,
    number of subscriptions for year 2010, total subscriptions months for the year
    2010, number of subscriptions for year 2011, total subscriptions months for the
    year 2011, number of subscriptions for year 2012, total subscriptions months
    for the year 2012, number of subscriptions for year 2013, total subscriptions
    months for the year 2013, last subscription end date, last subscription payment
    type ,last subscription branch no
guys i have 3 tables as described below:
1-ft_subscriptions as :
    SU_SUB_NO NUMBER(12,0)
    SU_SUB_DATE DATE
    SU_BRANCH_NO VARCHAR2(10 BYTE)
    SU_MEMBER_NO VARCHAR2(12 BYTE)
    SU_SUB_STATUS CHAR(1 BYTE)
    SU_SUB_TYPE CHAR(1 BYTE)
    SU_SERVICE_NO NUMBER(5,0)
    SU_SERVICE_TYPE VARCHAR2(5 BYTE)
    SU_NO_OF_UNIT NUMBER(5,0)
    SU_START_DATE DATE
    SU_END_DATE DATE
    SU_PRICE_AMT NUMBER(13,2)
    SU_DISC_AMT NUMBER(13,2)
    SU_EXTRA_DISC NUMBER(13,2)
    SU_NET_AMT NUMBER(13,2)
    SU_GROUP_NO NUMBER(12,0)
    SU_PROM_OFFER_NO NUMBER(12,0)
    SU_UPGRADING_SUB_NO NUMBER(12,0)
    SU_SECOND_SUB_NO VARCHAR2(12 BYTE)
    SU_NOTES VARCHAR2(2000 BYTE)
    SU_COMMENTS1 VARCHAR2(2000 BYTE)
    SU_COMMENTS2 VARCHAR2(2000 BYTE)
    SU_CRE_DATE DATE
    SU_CRE_BY VARCHAR2(30 BYTE)
    SU_AVAIL_CPN NUMBER(4,0)
    SU_EXTRA_DISC_PCT NUMBER(6,3)
    SU_CREDIT_AMT NUMBER(13,2)
    SU_CUSTOMER_NO VARCHAR2(10 BYTE)
    SU_AUDITING_BY VARCHAR2(30 BYTE)
    SU_AUDITING_DATE DATE
    SU_AUDITING_NOTES VARCHAR2(2000 BYTE)
    SU_POSTED CHAR(1 BYTE)
    SU_ACTIVIATION_DATE DATE
    SU_NO_OF_MONTHS NUMBER(7,2)
    SU_ENTRYTIME_CODE NUMBER(5,0)
    SU_CATEGORY VARCHAR2(5 BYTE)
    SU_ACT_START_DATE DATE
    SU_ACT_END_DATE DATE
    SU_SECOND_BRANCH_NO VARCHAR2(3 BYTE)
    SU_ADMIN_DISC_EMP VARCHAR2(10 BYTE)
    SU_DISC_TYPE VARCHAR2(1 BYTE)
    SU_BRANCH_PRICE_FLAG VARCHAR2(1 BYTE)
    SU_MISSING_DATA_FLAG VARCHAR2(1 BYTE)
    SU_CREDIT_PCT NUMBER(6,3)
    SU_BONUS_DAYS NUMBER(5,0)
    SU_UNPS_TRANS_BRANCH VARCHAR2(3 BYTE)
    SU_UNPS_TRANS_SERIAL NUMBER(12,0)
    SU_UNPS_TRANS_DATE DATE
    SU_ALLOWED_TRANS VARCHAR2(1 BYTE)
    SU_PREVIOUS_BAL NUMBER(10,0)
    SU_CASHIER_BRANCH VARCHAR2(10 BYTE)
    SU_CASHIER_SERIAL NUMBER(12,0)
    SU_PAY_TYPE CHAR(1 BYTE)
    SU_OFFER_FREE_DAYS NUMBER(4,0)
    SU_DOCNO VARCHAR2(20 BYTE)
    SU_MSPNO VARCHAR2(20 BYTE)
    SU_DOCTYPE VARCHAR2(10 BYTE)
    SU_LOCNO VARCHAR2(10 BYTE)
    SU_DOC_PFX VARCHAR2(5 BYTE)
    SU_DOC_NO NUMBER(10,0)
    SU_MOD_BY VARCHAR2(30 BYTE)
    SU_MOD_DATE DATE
    SU_MEMBER_FRIEND VARCHAR2(12 BYTE)
    SU_OFFER_FREE_SERVICE NUMBER(5,0)
    SU_FRIEND_START_DATE DATE
2-ft_members as :
    MB_BUS_UNIT VARCHAR2(5 BYTE)
    MB_MEMBER_NO VARCHAR2(12 BYTE)
    MB_MEMBER_NAME VARCHAR2(60 BYTE)
    MB_MEMBER_STATUS CHAR(1 BYTE)
    MB_MEMBERSHIP_DATE DATE
    MB_MEMBER_BRANCH VARCHAR2(10 BYTE)
    MB_MEMBER_TYPE CHAR(1 BYTE)
    MB_MEMBER_NAT VARCHAR2(5 BYTE)
    MB_ID_TYPE NUMBER(3,0)
    MB_ID_NO VARCHAR2(15 BYTE)
    MB_ID_DATE DATE
    MB_BIRTH_DATE DATE
    MB_PHONE_NO VARCHAR2(15 BYTE)
    MB_MOBILE_NO VARCHAR2(15 BYTE)
    MB_POBOX NUMBER(10,0)
    MB_POSTAL_CODE VARCHAR2(25 BYTE)
    MB_ADDRESS VARCHAR2(2000 BYTE)
    MB_EMAIL VARCHAR2(100 BYTE)
    MB_CUSTOMER_NO VARCHAR2(10 BYTE)
    MB_EMP_NO VARCHAR2(15 BYTE)
    MB_MARKETTING_WAY CHAR(2 BYTE)
    MB_IMG VARCHAR2(350 BYTE)
    MB_NOTES VARCHAR2(2000 BYTE)
    MB_ACTIVE_NOTE VARCHAR2(2000 BYTE)
    MB_INACTIVE_NOTE VARCHAR2(2000 BYTE)
    MB_CRE_BY VARCHAR2(30 BYTE)
    MB_CRE_DATE DATE
    MB_VIA_MEMBER VARCHAR2(12 BYTE)
    MB_VIA_BRANCH VARCHAR2(10 BYTE)
    MB_VIA_SUB NUMBER(12,0)
    MB_ID_EXPIRY_DATE DATE
    MB_ID_DATE_HJ DATE
    MB_BIRTH_DATE_HJ DATE
    MB_ID_EXPIRY_DATE_HJ DATE
    MB_LANG VARCHAR2(1 BYTE)
    MB_JOB_TYPE NUMBER(10,0)
    MB_JOB_CLASS NUMBER(10,0)
    MB_JOB_PLACE NUMBER(10,0)
    MB_EMP_ID_EXPIRY_DATE DATE
    MB_EMP_ID_EXPIRY_DATE_HJ DATE
    MB_MEDIA_TYPE VARCHAR2(5 BYTE)
    MB_RELATIVE_MEMBER VARCHAR2(12 BYTE)
    MB_RELATIVE_EMP VARCHAR2(10 BYTE)
    MB_ID_COPY NUMBER(2,0)
    MB_ACQUIST_DISC_PCT NUMBER(6,3)
    MB_ACQUIST_DISC_TYPE VARCHAR2(1 BYTE)
    MB_ADDED_BONUS_FLAG VARCHAR2(1 BYTE)
    MB_REVIEW_SUB_NO NUMBER(12,0)
    MB_REVIEW_BRH_NO VARCHAR2(10 BYTE)
    MB_RECEIVED_SMS VARCHAR2(1 BYTE)
    MB_CARD_NO VARCHAR2(8 BYTE)
    MB_MOD_BY VARCHAR2(30 BYTE)
    MB_MOD_DATE DATE
    MB_MEMBER_NO7 VARCHAR2(12 BYTE)
    3-ft_services as :
    SRV_BUS_UNIT VARCHAR2(5 BYTE)
    SRV_SERVICE_NO NUMBER(5,0)
    SRV_SERVICE_DESC1 VARCHAR2(50 BYTE)
    SRV_SERVICE_DESC2  VARCHAR2(50 BYTE)
    SRV_SERVICE_TYPE VARCHAR2(5 BYTE)
    SRV_SERVICE_STATUS CHAR(1 BYTE)
    SRV_SERVICE_PRICE NUMBER(12,5)
    SRV_NO_OF_UNIT NUMBER(5,0)
    SRV_START_TIME NUMBER(7,0)
    SRV_END_TIME NUMBER(7,0)
    SRV_DURATION NUMBER(7,0)
    SRV_POINTS NUMBER(7,0)
    SRV_NOTES VARCHAR2(2000 BYTE)
    SRV_CRE_BY VARCHAR2(30 BYTE)
    SRV_CRE_DATE DATE
    SRV_MIN_PEND_DAYS NUMBER(3,0)
    SRV_MAX_PEND_DAYS NUMBER(3,0)
    SRV_MIN_EXT_DAYS NUMBER(3,0)
    SRV_MAX_EXT_DAYS NUMBER(3,0)
    SRV_BONUS_DAYS NUMBER(3,0)
    SRV_MAX_PEND_COUNT NUMBER(3,0)
    SRV_MAX_EXT_COUNT NUMBER(3,0)
    SRV_CATEGORY VARCHAR2(5 BYTE)
    SRV_EXTEND_DAYS NUMBER(3,0)
    SRV_NO_OF_MONTHS NUMBER(7,2)
    SRV_ENTRYTIME_CODE NUMBER(5,0)
    SRV_ALLOW_PERIOD NUMBER(5,0)
    SRV_RELATIVE_EMP_PCT NUMBER(6,3)
    SRV_RELATIVE_MBR_PCT NUMBER(6,3)
    SRV_DAYS_BEFORE_END NUMBER(3,0)
    SRV_DAYS_AFTER_END NUMBER(3,0)
    SRV_ALLOWED_WAIVE VARCHAR2(1 BYTE)
    SRV_ALLOWED_SUB_TRANS VARCHAR2(1 BYTE)
    SRV_UPGRADE_LIMIT NUMBER(4,0)
    SRV_MIN_AEG_ALLOWED NUMBER(5,2)
    SRV_MAX_AEG_ALLOWED NUMBER(5,2)
    SRV_WAIVE_LIMIT NUMBER(4,0)
    SRV_ALLOW_ACQUIRED_DISC VARCHAR2(1 BYTE)
i need to get a report  have these info like this one:
    member_no, member_name, member_mobile_no, mb_membership_date, number of
    subscriptions for year 2009, total subscriptions months for the year 2009,
    number of subscriptions for year 2010, total subscriptions months for the year
    2010, number of subscriptions for year 2011, total subscriptions months for the
    year 2011, number of subscriptions for year 2012, total subscriptions months
    for the year 2012, number of subscriptions for year 2013, total subscriptions
    months for the year 2013, last subscription end date, last subscription payment
    type ,last subscription branch no
guys this is very urgent for my company needs,thnx in advance

Similar Messages

  • Ad Hoc Query from table PPDIT

    Hi,
    I'm creating an ad hoc query to retrieve data from table PPDIT by filtering the transaction key. This is to get a list of amounts posted to the technical accounts(Transaction key HRA). However, the query output and the output from table PPDIT through SE16 are different. It seems like the query only picks up transaction key HRF. Anyone with any ideas why?

    Hi,
    Than you add the additional field from extras option.
    click on extras tab.
    From there add table add field add structure.
    If you want to add a field write the name of the field and continue.
    suppose the field is matnr.
    Long text = material number
    header = material number
    and in like reference = mara-matnr.
    tablename-field name.
    let me know if this helps you.
    Regrds,
    Nikhil.

  • Calling Oracle Application Form From Table Action (Single Select)

    Can I call a Oracle Application Form From a Table (Table Select, Select Button).
    I also See Destination Function Could That Be Used to Launch Oracle Application Form Using One of the Columns Data (Service Request ID to Launch Service Requests Form)
    Let me know
    Thanks

    Can I call a Oracle Application Form From a Table (Table Select, Select Button).
    Yes can call on select Button
    Thanks

  • J2IUN Mismatch with query from table J_1IPART2

    Hi experts,
    If I run the TCODE J2IUN there is a marked difference for the RG23C register BED, AED, Cess, and HCess values that have been taken from table J_1IPART2 for the same period. What could be the cause for these differences and why did they occur or do I have to take addtional records from another table also. Well I am considering the Opening balances also.
    Please can you help me regarding this.
    Regards
    Yao Chhang

    You will have to first trace the difference. In the next step, go through J2IUN in debug mode with Abaper & check from where all the data is being picked. Next check whether all the data pick point are considered in Query.
    Regards,
    Rajesh Banka
    Reward suitable points.

  • Help in query from table

    Hi,
    I am having a strange issue,
    i have a table containing the following amgst others
    rec_time sys_date
    7:00 04/08/2010
    8:00 04/08/2010
    9:00 05/08/2010
    I need to query this table and return the max(rec_time) for all sys_date = sysdate
    its not working if i do the following
    select max(rec_time) from table
    where sys_date = sysdate;

    hello,
    this is my table structure for hourly_sales
      ID                 NUMBER,
      PRODUCT            VARCHAR2(25 BYTE)          NOT NULL,
      GAME_ID            NUMBER                     NOT NULL,
      SYS_DATE           DATE                       NOT NULL,
      CONFIRMED          CHAR(1 BYTE)               DEFAULT 'N',
      ACT_AMT            NUMBER                     NOT NULL,
      CUMM_AMT           NUMBER                     NOT NULL,
      COUNT_SALES        NUMBER                     NOT NULL,
      CREATED_BY         VARCHAR2(25 BYTE),
      CREATION_DATE      DATE,
      LAST_UPDATED_BY    VARCHAR2(25 BYTE),
      LAST_UPDATED_DATE  DATE,
      REC_TIME           VARCHAR2(25 BYTE)          NOT NULL,
      ORDER_ID           NUMBERI have created a small application in APEX that has an LOV for rec_time from 7.00 to 22.00. this is just an indication to the times that values are being entered.
    Now those geezers were making mistakes and the reason why i wanted my query was to enable them to roll-back on a button click
    delete from hourly_sales
    where rec_time = max(rec_time)
    and trunc(sys_date) = trunc(sysdate);but when i was querying it was not returning any values.

  • How to query from tables?

    Hi!
    I have two table, and I want to execute a query statement from them. How to do this?
    Thanks so much!

    Hi,
    If you go to otn.oracle.com/products/jdev you find tutorials and Oracle By Example (OBE) instructions.
    These get you started
    Frank

  • Fetch Insert / Update Query From Table Trigger

    Hi everyone !,
    I have a situation, is there any way where I can get insert/update query by before-insert / after insert trigger when a user inserts/updates any row in the table.
    Plz....help me....champs.....
    Regards,
    Naushad

    That was a nice thing but it works only on some oracle 9i with DML statements.
    On database versions 9.2.0.1 to 9.2.0.6 ora_sql_text works and returns the calling text for dml triggers, where as starting from 9.2.0.7 the behavior has changed and returns NULL.
    Cause
    This issue had surfaced from 9.2.0.7.0 patchset. After discussions in Bug 4171597 which was closed as a duplicate of Bug 4230721 it was concluded that it was the expected behavior i.e ORA_SQL_TXT should return null when dml triggers are used.
    ORA_SQL_TXT is a "System defined event attribute" and is supposed to work only with "System triggers". This is also what the Documentation says - "Application Developers Guide : Fundamentals(9.2)
    Chapter 16 Working with System events".
    Bye Alessandro

  • Oracle SQL Query from EXCEL 2007 with prompt

    Hello,
    I have many excel reports where I am pulling information from our Oracle 9 db through Excel using the following method:
    http://blog.mclaughlinsoftware.com/microsoft-excel/how-to-query-oracle-from-excel-2007/
    http://blog.mclaughlinsoftware.com/2009/11/30/sql-query-in-excel-2007/
    However, I am having trouble when I try the following query due to the prompt:
    SELECT
    IM.ITEM_GROUP,
    IM.ITEM,
    IM.DESCRIPTION
    FROM
    LAWSON.ITEMMAST IM
    WHERE
    IM.ITEM = '&ITEM';
    Does any one know how I can connect a prompt to an excel cell and then pass the query on to Oracle, or have a PL SQL prompt work from Excel?
    Thanks,
    Ben

    The 'prompt' as you call it is a sqlplus feature, so does not belong to the SQL language
    You would need to write a stored procedure returning a resultset.
    create or replace procedure foo(rc in out sys_refcursor, p_item) as
    begin
    open rc for
    'SELECT
    IM.ITEM_GROUP,
    IM.ITEM,
    IM.DESCRIPTION
    FROM
    LAWSON.ITEMMAST IM
    WHERE
    IM.ITEM = '||p_item;
    end;
    and call that using ODBC or asp.net
    Obviously this is profusely documented.
    Sybrand Bakker
    Senior Oracle DBA

  • How to Query from table and insert into another table.

    Hi
    I am using the following query in VO and all the columns are attached to EO ( table name emp_temp)
    select a.npw_number, a.person_id,b.assignment_id,a.title,a.last_name,a.first_name,a.date_of_birth,a.sex,
    b.organization_name,b.organization_id,b.job_id,b.job_name,b.position_id,b.position_name,b.supervisor_id,
    b.supervisor_name,b.location_id,b.effective_start_date,b.effective_end_date
    from per_all_people_f a,per_assignments_v b
    where a.person_id=b.person_id
    and a.npw_number=:1
    I can query the data in screen. I need into insert the data into the emp_temp.
    I don't know how to do this . Please help me.
    Thanks
    Subra

    You can create a VO based on EO on emp_temp table.....
    And u have attached a Different VO on the page... Right...
    Now what u can do is....once u click on apply....
    u can set the each attributes of EO based VO explicitly via code, from the values of second VO.... and then commit.....
    Perhaps this might help...

  • Oracle  deleting rows from tables starting with the name PQ

    hai friends
    we are given access rights to delete only tables starting with PQ. HAVING PQ_NUM as primary key for all the PQ tables.
    totally we have 6 tables. PQ_01,PQ_02, PQ_03,PQ_04,PQ_05,PQ_06.
    ALL This tables will have one primary key. for example pq_01 willl have pq01_num as primarykey and pq_02 table will have pq02_num as primary
    key.
    pq01_num value will exist in all the primary key of pq tables.
    i want query to delete rows from the pq tables based on the input value i give.
    for example if i give primarykey value 122 then that value in pq tables should be deleted.
    One more problem is there. pq_06 table does not have pq02_num column. here the column differs. it is pq06_num_req.
    so give your idea of deleting the rows from pq tables
    waiting
    S

    I dont have access to databse,this is untested
    declare
      v_cmd  varchar2(2000);
      columnname varchar2(30);
    input_value number:=??;
    tabowner varchar2(30):=???
    begin
    --step 1 identify table
      FOR sub IN (SELECT table_name table_to_delete
      FROM all_tables
    WHERE table_name LIKE 'PQ%'
    and owner=tabowner
    ) LOOP
      ----step 2 identify column
    v_cmd :='select t.column_name from all_constraints S,All_Ind_Columns T where
    S.OWNER=T.TABLE_OWNER
    AND S.TABLE_NAME=T.TABLE_NAME
    AND S.INDEX_NAME=T.INDEX_NAME
    and s.owner=tabowner
    AND S.TABLE_NAME='||table_to_delete||'
    and s.constraint_type='''P'';
         execute immediate v_cmd into columnname; 
         --step 3 delete records
        v_cmd := 'delete from '||tabowner||'.' ||
                 sub.table_to_delete || '
       where '||columnname||'='||input_value; 
         execute immediate v_cmd;
        commit;
         END LOOP; 
    end;Edited by: user5495111 on Aug 11, 2009 6:35 AM

  • Query from table a and insert to table b

    Hi,
    I would like to create an attendance page to record student's attendance on a particular dates.
    I have 2 tables - students and attendance tables; in which attendance table will consist of PK from students table and date.
    How do I create a form that display all the students record in a page with checkbox and date column; and when user check the boxes and click save; it will insert record into attendance table? Thanks!
    Layout similar to the below:
    Date: 1/1/2010 (user input)
    Name: Attend
    student 1 (checkbox)
    student 2 (checkbox)
    student 3 (checkbox)
    student 4 (checkbox)
    .....

    Hi Aaron,
    For this you can do the following
    1. Create a Tabular Form on The STUDENT table, i.e. the table you are using as a Fecth only table
    2. Make the ApplyMRU and ApplyDRD process conditions Never so they will not be executed
    3. Write your own custom process to write the checked rows into Attendence Table.
    In the process you will have to refer to the checkbox f+nn+ item using APEX_APPLICATION.G_F+nn+ array and write from similar arrays for the other tabular form items
    You will find useful code snippets in the Apex Help , Advanc3ed Tutorials as well as here http://www.oracle.com/technology/products/database/application_express/howtos/tabular_form.html#MANUAL
    Regards,

  • Oracle Spatial Query from SQLPLUS deteriorates in performance

    Hi,
    I am running an sql-procedure, which does spatial queries. When I run this procedure (from SQLPLUS) for the first time it takes around 45 sec to complete, but when I run the same procedure for the second time it takes 65 seconds and the performance keeps on decreasing. But if I open a new SQLPLUS session it takes 45 secs and it also starts deteriorating subsequently. This strange behaviour is only for spatial queries, if I don't have spatial queries in my procedure then its fine.
    I found this behaviour for any type of spatial query.
    Is there something which can be done for improving it ? I found a lot of information on improving performance of a query, but my problem is to maintain the same performance of the same query in the same session.
    Thanks,
    Rishi

    Hi,
    Could you provide version information?
    Also, could you try monitoring memory as the procedure is running an see
    if memory climbs more each time the procedure is run?
    Thanks

  • Query from oracle to MySql using dblink fetch all the rows in MySql table

    Hello,
    I am using Heterogeneous connectivity between oracle 10204 to Mysql database.
    I have a database link in the oracle side .
    I am query a table in MySql that have 10 million rows.
    Its doesnt matter if i am running :
    select * from "CDR_Accounts"@mysql where "id"=7675405;
    or
    select * from "CDR_Accounts"@mysql ;
    There is an index on the id column.
    Yet, it seems that the Mysql is feteching all the rows from the table , all the data is transfering to oracle over the dblink , and only after that the requested rows are get back to the client.
    The /etc/odbcinst.ini file is as follow:
    [odbcprd:oracle@odbc /software/oracle]$ cat /etc/odbcinst.ini
    [myodbc3]
    Description             = Mysql connector to mysql version 3.5
    Driver          = /software/oracle/MysqlOdbc/3.52/lib/libmyodbc3-3.51.25.so
    Driver64                = /usr/lib
    Setup           = /software/oracle/MysqlOdbc/3.52/lib/libmyodbc3S-3.51.25.so
    Setup64         = /usr/lib
    UsageCount              = 1
    CPTimeout               = 3600
    CPReuse         = Please advice
    Thanks

    When using a gateway it is always possible that a where clause is not sent to the remote database. This is called post processing and depends on several factors like the used ODBC driver, the columns and its data types but also if you specify certain functions in the where clause.
    The fastest way to see if post processing happens is in Oracle 11g the explain plan for a query. In 10g the plan does not always match the statement sent to the foreign database. Here it would be better to enable gateway tracing and setting the trace level to ON. This will log the statements sent to the foreign database and you can compare what statement was sent with the statement you've tried to execute.

  • Query DB2 tables from oracle using normal view

    This is with regard to querying db2 tables using oracle views. The view is created using dblink. The querying is not an one time activity.querying will be done once in a day. Can i use normal view (will it work ) or should i use materialised view. will i be able to view the added records in db2 table using normal view?
    thanks,
    vinodh

    Vinodh2 wrote:
    This is with regard to querying db2 tables using oracle views. The view is created using dblink. The querying is not an one time activity.querying will be done once in a day. Can i use normal view (will it work ) or should i use materialised view. will i be able to view the added records in db2 table using normal view?How can the SQL select statement via a dblink not work for a view, but the same SQL select statement work for a materialised view?
    Do you think the database link or remote database care whether the select SQL that hits it, comes from a PL/SQL procedure, a view, a materialised view, a job or whatever else? It has no idea what/who is behind that select SQL - and nor does it care.
    As for the benefits of a view vs. a materialised view - that depends on the requirements for needing to use that foreign database's data in the local database.

  • Synonym required to query custom tables from Oracle Apps database

    When creating an Answers report that queries from a table owned by a custom schema (not APPS), I cannot query the table and get error. Once I add a Synonym for APPS on this table, then OBIEE works normally.
    Since OBIEE is logging in as the APPS user, are Synonyms required for all non-APPS tables/views or is there another feature of the Administrator where it can store the table alias (our typical owner of custom tables is XXFI)?

    OK, well "compare" can mean one of two things: Compare structure or compare contents. Here is a quick script to compare column structures of two tables on one database:
    (select COLUMN_NAME,
    DATA_TYPE,
    DATA_LENGTH,
    DATA_PRECISION,
    DATA_SCALE,
    NULLABLE
    from dba_Tab_columns
    where owner=:OWNR1
    and table_name = :tablename
    minus
    select COLUMN_NAME,
    DATA_TYPE,
    DATA_LENGTH,
    DATA_PRECISION,
    DATA_SCALE,
    NULLABLE
    from dba_Tab_columns
    where owner=:ownr2
    and table_name = :tablename)
    union all
    (select COLUMN_NAME,
    DATA_TYPE,
    DATA_LENGTH,
    DATA_PRECISION,
    DATA_SCALE,
    NULLABLE
    from dba_Tab_columns
    where owner=:ownr2
    and table_name = :tablename
    minus
    select COLUMN_NAME,
    DATA_TYPE,
    DATA_LENGTH,
    DATA_PRECISION,
    DATA_SCALE,
    NULLABLE
    from dba_Tab_columns
    where owner=:ownr1
    and table_name = :tablename)
    If this query returns any rows, then these indicate that there are structural differences between the tables. We do a minus in both directions to ensure that an additional column in either schema will be returned in the query.
    If you are going across dblinks to remote tables then you have to amend the "dba_tab_columns" to "sys.dba_tab_columns@yourdblink"
    If you also want to compare indexes, triggers, etc then do the same sort of thing for the associated dba_ views for those objects.
    And if you want to compare table contents, then often the fastest way is also to check minuses in both directions, if the tables are not too big:
    e.g.
    (select * from schema1.table@dblink1
    minus
    select * from schema2.table@dblink2)
    union all
    (select * from schema2.table@dblink2
    minus
    select * from schema1.table@dblink1)
    local tables, of course, simply omit the "@dblink" issues.
    There are tools to help in such things. TOAD, for example, has a pretty good schema comparison tool, and there are plenty of other options out there. But if you need to script this yourself then the logic I've shown is a good starting point.
    Cheers,
    Mike

Maybe you are looking for

  • Purchase item not showing in cloud

    I deleted a couple TV shows that I had purchased and trashed them.  I thought they would show up as being in the cloud but I don't see that.  Do you know why?

  • Have an image stay within a moving mask in stock video footage

    HI, I am new to Motion (still using Motion 4) and I have some stock footage that has a mask contained within a TV screen that swings down from the ceiling.  I can easily get the jpeg I want within the TV screen when it's not moving, but how do I get

  • Where to Buy in Florida? (WRVS4400N)

    Would someone tell me where to buy the WRVS4400N VPN capable Wireless Router, in Florida? Hopefully / preferably if possible, at a retail store ? thanks,

  • Help:I can't get correct display

    I write a program with java, and some chinese word string are used. when it runs on platform win2000, all is right. but, when I run it on redhat9, I can't read them strings why? what should I do to correct it?

  • ISE Question

      In ISE, For the Guest server, can a second NIC interface be used to physically connect the guest interface to a DMZ?  If so, can you provide a link?