Delete using joins in Oracle 10g

Hi All
I am trying to delete rows from a table by comparing the criteria required with the rows in different tables..
The select statement below works fine...But when I use it for delete as shown in the subsequent SQL statement it errors out stating "SQL Command not properly ended"
Can anybody provide suggestions?....
This works fine
select rp.emplid,rp.empl_rcd,rp.dur,rp.punch_type,dt.dur,
TO_CHAR(CAST((rp.PUNCH_TIME) AS TIMESTAMP),'HH24.MI.SS.FF') AS PUNCH_TIME
from
ps_tl_rptd_time rp
join ps_hd_dt_end_tmp4 dt on (rp.emplid = dt.emplid and rp.dur = dt.dur +1 AND(rp.punch_time = dt.PUNCH_TIME_8
or rp.punch_time = dt.PUNCH_TIME_7
or rp.punch_time = dt.PUNCH_TIME_6
or rp.punch_time = dt.PUNCH_TIME_5
or rp.punch_time = dt.PUNCH_TIME_4
or rp.punch_time = dt.PUNCH_TIME_3
or rp.punch_time = dt.PUNCH_TIME_2) )
join ps_fo_empl_xref fo on (rp.emplid = fo.emplid and rp.empl_rcd = fo.empl_rcd and dt.pbm_asgn_id = fo.pbm_asgn_id)
and TO_CHAR(CAST((rp.PUNCH_TIME) AS TIMESTAMP),'HH24.MI.SS.FF') BETWEEN '00.00.00.000000' AND '11.59.59.000000'
While this below one doesnt work.....
delete from
ps_tl_rptd_time rp
join ps_hd_dt_end_tmp4 dt on (rp.emplid = dt.emplid and rp.dur = dt.dur +1 AND(rp.punch_time = dt.PUNCH_TIME_8
or rp.punch_time = dt.PUNCH_TIME_7
or rp.punch_time = dt.PUNCH_TIME_6
or rp.punch_time = dt.PUNCH_TIME_5
or rp.punch_time = dt.PUNCH_TIME_4
or rp.punch_time = dt.PUNCH_TIME_3
or rp.punch_time = dt.PUNCH_TIME_2) )
join ps_fo_empl_xref fo on (rp.emplid = fo.emplid and rp.empl_rcd = fo.empl_rcd)
where dt.pbm_asgn_id = fo.pbm_asgn_id and
TO_CHAR(CAST((rp.PUNCH_TIME) AS TIMESTAMP),'HH24.MI.SS.FF') BETWEEN '00.00.00.000000' AND '11.59.59.000000'
;

may be
delete from ps_tl_rptd_time rp
where  exists (select 1
               from   ps_hd_dt_end_tmp4 dt
               where  rp.emplid = dt.emplid
                      and rp.dur = dt.dur + 1
                      and ( rp.punch_time = dt.punch_time_8
                             or rp.punch_time = dt.punch_time_7
                             or rp.punch_time = dt.punch_time_6
                             or rp.punch_time = dt.punch_time_5
                             or rp.punch_time = dt.punch_time_4
                             or rp.punch_time = dt.punch_time_3
                             or rp.punch_time = dt.punch_time_2 ))
       and exists (select 1
                   from   ps_fo_empl_xref fo
                   where  rp.emplid = fo.emplid
                          and rp.empl_rcd = fo.empl_rcd
                          and dt.pbm_asgn_id = fo.pbm_asgn_id)
       and to_char(cast(( rp.punch_time ) as timestamp), 'HH24.MI.SS.FF')
           between
           '00.00.00.000000' and '11.59.59.000000' 

Similar Messages

  • Inner Join in oracle 10g

    Is it possible to use inner join in oracle 10g?

    SQL> select ename, dname
      2  from emp inner join dept
      3  on emp.deptno=dept.deptno;
    ENAME      DNAME
    SMITH      RESEARCH
    ALLEN      SALES
    WARD       SALES
    JONES      RESEARCH
    MARTIN     SALES
    BLAKE      SALES
    CLARK      ACCOUNTING
    SCOTT      RESEARCH
    KING       ACCOUNTING
    TURNER     SALES
    ADAMS      RESEARCH
    ENAME      DNAME
    JAMES      SALES
    FORD       RESEARCH
    MILLER     ACCOUNTING
    14 rows selected.
    SQL>

  • Why we dont use STANDBY_ARCHIVE_DEST in oracle 10g

    Hi,
    Why we dont use standby_archive_dest in oracle 10g standby database,
    at which location the archives will arrive in standby database if standby redo logs created &
    at which location the archives will arrive in standby database if standby redo logs are not created.
    Please answer.
    Thanks

    Hi,
    But B14239-05 doc for oracle database 10g ,
    Under the 3rd chapter,
    Example 3-5 Modifying Initialization Parameters for a Physical Standby Database
    DB_NAME=chicago
    DB_UNIQUE_NAME=boston
    LOG_ARCHIVE_CONFIG='DG_CONFIG=(chicago,boston)'
    CONTROL_FILES='/arch1/boston/control1.ctl', '/arch2/boston/control2.ctl'
    DB_FILE_NAME_CONVERT='chicago','boston'
    LOG_FILE_NAME_CONVERT=
    '/arch1/chicago/','/arch1/boston/','/arch2/chicago/','/arch2/boston/'
    LOG_ARCHIVE_FORMAT=log%t_%s_%r.arc
    LOG_ARCHIVE_DEST_1=
    'LOCATION=/arch1/boston/
    VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
    DB_UNIQUE_NAME=boston'
    LOG_ARCHIVE_DEST_2=
    'SERVICE=chicago LGWR ASYNC
    VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
    DB_UNIQUE_NAME=chicago'
    LOG_ARCHIVE_DEST_STATE_1=ENABLE
    LOG_ARCHIVE_DEST_STATE_2=ENABLE
    REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
    STANDBY_FILE_MANAGEMENT=AUTO
    FAL_SERVER=chicago
    FAL_CLIENT=boston
    standby_archive_dest is not mentioned?
    Why??

  • How to use iframes in oracle 10g

    I have to load two jsp pages in a single html . I have done that thru iframes. But i have to dynamically load the second jsp page in the frame 2 , when the user clicks upon certain details in the frame 1 jsp page. I have wriiten the code of document.iframe in format trigger attribute. It doesn't work. Is there any other way to achieve this. I want to load the frame 2 jsp page dynamically , according to the input i get from frame 1 jsp page.

    Hi,
    >>Anybody know how to use profiler in oracle 10g
    What do you mean "profiler". About Resource Limits/Create Profiles ?
    >>i couldn't able to install the enterprise manager console.
    What OS ?
    >>because i need to trace the execution of a stored procedure.waiting the reply.
    Debug ? You can use SQL Developer, TOAD, PLSQL Developer for this purpose.
    Cheers

  • How to Use Profiler in ORACLE 10g

    Hi all,
    Anybody know how to use profiler in oracle 10g and also i couldn't able to install the enterprise manager console.is there any tools available for that.because i need to trace the execution of a stored procedure.waiting the reply.
    Sathish

    Hi,
    >>Anybody know how to use profiler in oracle 10g
    What do you mean "profiler". About Resource Limits/Create Profiles ?
    >>i couldn't able to install the enterprise manager console.
    What OS ?
    >>because i need to trace the execution of a stored procedure.waiting the reply.
    Debug ? You can use SQL Developer, TOAD, PLSQL Developer for this purpose.
    Cheers

  • Reg.SMTP Error while using UTL_MAIL in Oracle 10g

    Hi,
    I am getting the following SMTP error while trying to use the UTL.MAIL package of Oracle 10g. The query is as follows.
    begin
    utl_mail.send(
    sender => 'NAVEEN',
    recipients => '[email protected]',
    subject => 'Testing utl_mail',
    message => 'The receipt of this email means'|| ' that UTL_MAIL works'
    end;
    UTL_MAIL package is installesd and the port 25 is configured and firewall is changed.
    The same block was working fine before 5 days and now is giving the error as
    ORA-29279: SMTP permanent error: 501 badly formatted MAIL FROM user - no "<"
    ORA-06512: at "SYS.UTL_SMTP", line 21
    ORA-06512: at "SYS.UTL_SMTP", line 99
    ORA-06512: at "SYS.UTL_SMTP", line 222
    ORA-06512: at "SYS.UTL_MAIL", line 407
    ORA-06512: at "SYS.UTL_MAIL", line 594
    ORA-06512: at line 2
    Could you please help me out how to proceed???
    Regards,
    Naveen Kumar.

    Can you back that statement about an Oracle UTL_SMTP bug up with an actual bug number??
    From what you have posted, this is not a bug!! but expected and documented (RFC'ed) SMTP server behaviour.
    My proof:
    /home/billy> telnet mail 25
    Trying 165.143.128.26...
    Connected to mail
    Escape character is '^]'.
    220 CNTRRA20-GTW01 [CNTRRA20-GTW01] Thu, 06 Mar 2008 14:26:26 +0200
    HELO 10.251.93.58
    250 CNTRRA20-GTW01 Hello [10.251.93.58]
    MAIL FROM: naveen <[email protected]>
    501 naveen <[email protected]> : illegal character(s) in domain string
    MAIL FROM: NAVEEN
    501 NAVEEN : domain string is NULL.
    quit
    221 CNTRRA20-GTW01 closing connection. Goodbye!
    Connection closed by foreign host.
    /home/billy>
    As you can clearly see, the SMTP server expects a DOMAIN name as part of the MAIL FROM address. It also does not accept the alternative format suggested.
    Yes, not all SMTP servers are equal and some support additional formatting.
    But to imply that because the SMTP server does not accept your address formatted as string NAVEEN, it is a UTL_SMTP problem, sounds like a smelly one to me.

  • Using JDeveloper with Oracle 10g Express Edition

    Hi,
    can JDeveloper 11g 11.1.1.4.0 Studio Edition be used to develop applications connection with Oracle 10g Express Edition?
    If not, is there a version downloadable that can?
    TIA

    Yes, it can.
    John

  • Migration using data pump Oracle 10g - Oracle 11g

    HI all,
    1)
    Right now I`m using Oracle 11g. I have a plan to import data from Oracle 10g. I would like to know if its possible to import data which was exported by datapump on Oracle 10g ?
    Should I convert somehow expdp output from Oracle 10g to Oracle 11g format ?
    2)
    Next question is. If I will use expdp to create dump of complete database. May I use *.dmp to import selected users ? Or only full database can be restored ?

    Yes, you can import 10g dump into an 11g database.
    Maybe you should take some time and read the section on datapump in the fine Oracle® [Database Utilities|http://download.oracle.com/docs/cd/B28359_01/server.111/b28319/dp_import.htm#i1007324] manual.
    :p

  • How to generate report using toad in oracle 10g

    hi ,
    i am using oracle 10g with toad editor .if i am execute any table, result it will be 100 rows like, i want to make report each records page wise with header,footer etc..
    please help..
    thank u..

    That is a Toad question isn't it, and Larry still didn't buy Quest, so you are at the wrong address.
    Go to http://www.questsoftware.com and find their forums.
    Thank you.
    Sybrand Bakker
    Senior Oracle DBA

  • Can we use replication usings oracle 10g steams for EBS r12 database?

    HI,
    We are using EBS 12.0.6 and database 10.2.0.3 on linux 32-bit/64-bit OS (Multi-Node env).
    Actually We want to decrease the load of custom reports on actual production system, so thats why
    we need reports server and as my past experience I had used oracle streams for replication with simple schema based replication and tablespace replication also.
    So, please educate me, that can i used the oracle 10g streams for EBS schemas like APPS, GL ,INV, PO, ONT, ODM, AR, AP, CM etc?
    Please provide us the above related env docs and road Map.
    If you have any other way to create the Report Server?
    Regard,
    Fayaz Ahmed

    Hi,
    We are not in a position to upgrade the EBS from 12.0.6 to 12.1, because this is lengthy task, but we had already tested technically it in test env, but functional testing in pending.
    Now we want to immediate solution if possible, because this is production?
    So, please suggest another.
    regards

  • Using ASM in Oracle 10g

    Hi all,
    I'd like to learn using ASM (Automatic Storage Management) feature in Oracle 10g using a single PC. As far as I know, I need hardware of disk array.
    Is it possible to use ASM feature in Oracle 10g in a normal PC? or by using the normal IDE harddisk? or by using external USB hardisk? or by using any software emulator?
    I would highly appreciate any guideline.
    Thanks in advance.
    Ahmed B.

    You can find the for windows also on the same site. Below is the link:
    http://www.idevelopment.info/data/Oracle/DBA_tips/Automatic_Storage_Management/ASM_22.shtml

  • Using constraints in Oracle 10g

    Hi,
    I am confused on with this thing w.r.t to Oracle 10g.
    Whenever I try and create a constraint on a value like
    CONSTRAINT "Const1" CHECK (status in (0,1,-1))
    It creates a problem for me if I use the status variable with where clause
    like
    select * from table where status=0
    I get a
    ERROR at line 1:
    ORA-03113: end-of-file on communication channel
    Now this works fine if i create the above constraint as
    CONSTRAINT "Const1" CHECK (status in (-1,0,1))
    I am unable to find any reason for this.
    Please help.
    regards
    Gaurav
    Message was edited by:
    masand

    Hi,
    I'am using 10g 10.2.0.1.0 database. I had a query which select data from database. the query uses CAST(MULTISET to cast subquery into a scalar type. When I ran the query without ORDER BY statement, it works fine but the result is in random order. Now, when I put ORDER BY statement, I was given ora-03113 end-of-communication channel error.
    Can anyone tell why? Is it a bug? what is the workaround?
    Here is my query that without ORDER BY:
    SELECT a.assignment_no || '-' || TO_CHAR(a.item_seq) as "ASSIGNNO",
    A.photo_id as "PHOTOID",
    CAST(MULTISET
    (SELECT S.SIZE_DESC as "SizeDesc",
    S.SIZE_CODE as "SizeCode",
    D.QUANTITY Quantity,
    D.AMOUNT Amount,
    null REMARKS,
    S.SIZE_ORDER AS "SIZEORDER"
    FROM PHOTO_ORDER_DETAIL D, PHOTO_SIZE S
    WHERE S.SIZE_TYPE = 'FILMPRO'
    AND S.ODD_SIZE_FLAG = 'N'
    AND D.SIZE_CODE (+)= S.SIZE_CODE
    AND D.INPUT_YEAR (+)= 2006
    AND D.ORDER_NO (+)= 120
    AND D.PHOTO_ID (+)=A.PHOTO_ID
    AND D.YEAR (+)= A.YEAR
    ) AS order_size_list_t
    ) as "ColorPrint"
    FROM PHOTO_ARCHIVE A
    WHERE EXISTS (
    SELECT 1
    FROM PHOTO_ORDER_DETAIL E, PHOTO_SIZE B
    WHERE E.ORDER_NO = 120
    AND E.INPUT_YEAR = 2006
    AND B.SIZE_CODE=E.SIZE_CODE
    AND B.SIZE_TYPE='FILMPRO'
    AND B.ODD_SIZE_FLAG = 'N'
    AND a.YEAR=E.YEAR
    AND a.PHOTO_ID = E.PHOTO_ID);
    It's result OK but not in the order I desire
    Here is query with ORDER BY:
    SELECT a.assignment_no || '-' || TO_CHAR(a.item_seq) as "ASSIGNNO",
    A.photo_id as "PHOTOID",
    CAST(MULTISET
    (SELECT S.SIZE_DESC as "SizeDesc",
    S.SIZE_CODE as "SizeCode",
    D.QUANTITY Quantity,
    D.AMOUNT Amount,
    null REMARKS,
    S.SIZE_ORDER AS "SIZEORDER"
    FROM PHOTO_ORDER_DETAIL D, PHOTO_SIZE S
    WHERE S.SIZE_TYPE = 'FILMPRO'
    AND S.ODD_SIZE_FLAG = 'N'
    AND D.SIZE_CODE (+)= S.SIZE_CODE
    AND D.INPUT_YEAR (+)= 2006
    AND D.ORDER_NO (+)= 120
    AND D.PHOTO_ID (+)=A.PHOTO_ID
    AND D.YEAR (+)= A.YEAR
    ORDER BY S.SIZE_ORDER
    ) AS order_size_list_t
    ) as "ColorPrint"
    FROM PHOTO_ARCHIVE A
    WHERE EXISTS (
    SELECT 1
    FROM PHOTO_ORDER_DETAIL E, PHOTO_SIZE B
    WHERE E.ORDER_NO = 120
    AND E.INPUT_YEAR = 2006
    AND B.SIZE_CODE=E.SIZE_CODE
    AND B.SIZE_TYPE='FILMPRO'
    AND B.ODD_SIZE_FLAG = 'N'
    AND a.YEAR=E.YEAR
    AND a.PHOTO_ID = E.PHOTO_ID);
    The result is
    ORA-03113: end-of-file on communication channel

  • How to use help in oracle 10g XE

    Hello,
    I just wanted to know how to use help in sql command line in oracle 10g XE
    regards,
    Sreekanth.

    Hi thankyou very much for the answer, that web-page is very good but....
    I was hoping for answer that would walk me through the help command used in the SQL PLUS like: "help create"
    after i have read few manuals i came to know we can use @hlpbld.sql for building help tables it asks me for entering value 1 and 2, after that it exits the prompt and when i re-login i dont see "help command" working...
    any comments ot procedure to do this...

  • Deleted the region on oracle 10g portal page

    deleted the region on oracel 10g portal page . now i cannot access all the links on that region. is there any way i can get back those links and the region. Any idea where it will be stored(tables , database)
    Thanks

    What do you mean by links? URL items? PAge link items? Other kinds of items?
    If you delete a region, you delete the item content it contains, which is why you're asked "are you sure?" and are prompted to move content from the region you are about to delete (assuming your page layout allows it).
    If you need to recover those items, you'll need to go to your portal backup. (Yes, the lack of easy logical restores in Portal is a huge pain)
    and if you deleted the region that contained themthen those items are gone.
    At this point, you'd have to retrieve it from database backups (depending on what the items were, you could use wwsbr_all_items or wwv_things).
    Here's hoping those items are easy enough to recreate.
    -John

  • Using REGEXP_REPLACE in oracle 10g for repetition of the source string

    Hello all,
    I kept trying but unsuccessful, Here is what i would like.
    I have a source string and i would like that to be repeated in the way i would like.
    Let say, i have about 50 tables to write update statements for each with the same table from another database.
    So, I would like to take the columns i need for each table, use a regular expression and create a set clause.
    FOR EXAMPLE
    say, a table has 3 columns
    Source string is 'TABLE_COLUMN_1_ID,TABLE_COLUMN_2_VALUE,TABLE_COLUMN_3_DESC'
    I would like to use regular expressions in 10g and get this
    desired o/p
    'TABLE_COLUMN_1_ID = TABLE_COLUMN_1_ID,TABLE_COLUMN_2_VALUE = TABLE_COLUMN_2_VALUE,TABLE_COLUMN_3_DESC = TABLE_COLUMN_3_DESC'
    I thought s its easy with my knowledge of expressions but still struggling.
    Any help is greatly appreciated.
    Thanks.

    Something like this ?
    SELECT REGEXP_REPLACE('TABLE_COLUMN_1_ID,TABLE_COLUMN_2_VALUE,TABLE_COLUMN_3_DESC',
                          '([^,]+)', ' \1 = \1') x
    FROM DUAL;
    X
    TABLE_COLUMN_1_ID = TABLE_COLUMN_1_ID, TABLE_COLUMN_2_VALUE = TABLE_COLUMN_2_VALUE, TABLE_COLUMN_3_DESC = TABLE_COLUMN_3_DESC

Maybe you are looking for