oracle8i

add a comma (,) in Oracle

穿精又带淫゛_ 提交于 2019-12-23 15:48:59
问题 Given this query: select distinct subject_key from mytable Result: subject_key ----------- 90896959 90895823 90690171 90669265 90671321 How do i write a query in Oracle (using Aqua Data Studio backend Oracle 8i) result: subject_key ----------- 90896959, 90895823, 90690171, 90669265, 90671321 THANKS ALL! Should I wish to change the output across instead of down like below. How do I write it, same platform. Thanks. subject_key 90896959, 90895823, 90690171, 90669265, 90671321 回答1: Oracle doesn't

Query works on Oracle 11g but fails on Oracle 8i

好久不见. 提交于 2019-12-20 06:29:25
问题 I am running this query in Oracle 11g with no problem: select (case when seqnum = 1 then '1' when seqnum = cnt then '0' end) as value1, (case when seqnum = 1 then t.BEGIN_DT when seqnum = cnt then t.END_DT end) as TIME1, t4.UNIT1 || '.SUBBATCH_TRIGGER' TAG from (select t.*, row_number() over(partition by t.BATCH_ID, t.plant_unit, t3.ID2 order by t.BEGIN_DT) as seqnum, count(*) over(partition by t.BATCH_ID, t.plant_unit, t3.ID2) as cnt from SCH2.tb_pg_unit_stap t join (select ID1,batch_id from

Oracle : select maximum value from different columns of the same row

主宰稳场 提交于 2019-12-17 15:55:08
问题 The whole question is pretty much in the title. For each row of the table I'd like to select the maximum of a subset of columns. For example, from this table name m1 m2 m3 m4 A 1 2 3 4 B 6 3 4 5 C 1 5 2 1 the result would be name max A 4 B 6 C 5 The query must be compatible oracle 8i. 回答1: Given this test data ... SQL> select * 2 from your_table 3 / NAME M1 M2 M3 M4 ---- ---------- ---------- ---------- ---------- A 1 2 3 4 B 6 3 4 5 C 1 5 2 1 SQL> ... a straightforward GREATEST() call will

Alternatives to CASE in Oracle 8i [duplicate]

我的梦境 提交于 2019-12-13 08:48:27
问题 This question already has answers here : Query works on Oracle 11g but fails on Oracle 8i (2 answers) Closed 5 years ago . Thanks to the stackoverflow community I found out that this query is not supported in Oracle 8i because of the CASE WHEN. select (case when seqnum = 1 then '1' when seqnum = cnt then '0' end) as value1, (case when seqnum = 1 then t.BEGIN_DT when seqnum = cnt then t.END_DT end) as TIME1, t4.UNIT1 || '.SUBBATCH_TRIGGER' TAG from (select t.*, row_number() over(partition by t

ORA-00933: SQL command not properly ended in subquery with join

只谈情不闲聊 提交于 2019-12-11 02:27:53
问题 It's been a while for me since the last time I did Oracle SQL, hope someone can tell me why I get a 933 on: SELECT TRIM(A.ACCOUNTNUMBER) AS INDBDebnmbr , TRIM(A.VOUCHER) AS INinvoicenmbr , A.DATE_ AS INinvoiceDate , A.DUEDATE AS INinvoiceDueDate , A.TXT AS INDescription , A.EXCHANGECODE AS INCurrencyCode , subq.AMOUNTMST AS INOriginalamount , subq.SETTLEAMOUNTMST AS INpaidAmount , subq.OPENAMOUNT AS INOpenAmount FROM ( SELECT DEBTRANS.VOUCHER AS VOUCHER, SUM(DEBTRANS.AMOUNTMST) AS AMOUNTMST ,

Subtracting n Days from a date using SQL

谁说我不能喝 提交于 2019-12-07 11:21:08
问题 I am quite a beginner when it comes to Oracle. I am having trouble figuring out how to do something similar to this : SELECT ID, NAME, TO_CHAR(DATEBIRTH, 'DD/MM/YYYY HH24:MI:SS') FROM PEOPLE WHERE DATEBIRTH >= ANOTHERDATE - NDAY To put it short, I want to select everyone who were born N days before a specific date and time but I am not quite sure that this is the way to do it nor that it would give me the results I expect. PS: I am developping under oracle8i. 回答1: Your query looks correct to

Subtracting n Days from a date using SQL

丶灬走出姿态 提交于 2019-12-05 12:26:45
I am quite a beginner when it comes to Oracle. I am having trouble figuring out how to do something similar to this : SELECT ID, NAME, TO_CHAR(DATEBIRTH, 'DD/MM/YYYY HH24:MI:SS') FROM PEOPLE WHERE DATEBIRTH >= ANOTHERDATE - NDAY To put it short, I want to select everyone who were born N days before a specific date and time but I am not quite sure that this is the way to do it nor that it would give me the results I expect. PS: I am developping under oracle8i. Your query looks correct to me. That's how you subtract days from dates in Oracle. This link holds some more insight for you, should you

Query works on Oracle 11g but fails on Oracle 8i

二次信任 提交于 2019-12-02 10:03:05
I am running this query in Oracle 11g with no problem: select (case when seqnum = 1 then '1' when seqnum = cnt then '0' end) as value1, (case when seqnum = 1 then t.BEGIN_DT when seqnum = cnt then t.END_DT end) as TIME1, t4.UNIT1 || '.SUBBATCH_TRIGGER' TAG from (select t.*, row_number() over(partition by t.BATCH_ID, t.plant_unit, t3.ID2 order by t.BEGIN_DT) as seqnum, count(*) over(partition by t.BATCH_ID, t.plant_unit, t3.ID2) as cnt from SCH2.tb_pg_unit_stap t join (select ID1,batch_id from SCH2.VW_BATCH) t2 on t.BATCH_ID = t2.BATCH_ID join (select ID2,ID1 from SCH1.STEP) t3 on t3.ID1 = t2

Oracle : select maximum value from different columns of the same row

半腔热情 提交于 2019-11-27 20:25:25
The whole question is pretty much in the title. For each row of the table I'd like to select the maximum of a subset of columns. For example, from this table name m1 m2 m3 m4 A 1 2 3 4 B 6 3 4 5 C 1 5 2 1 the result would be name max A 4 B 6 C 5 The query must be compatible oracle 8i. Given this test data ... SQL> select * 2 from your_table 3 / NAME M1 M2 M3 M4 ---- ---------- ---------- ---------- ---------- A 1 2 3 4 B 6 3 4 5 C 1 5 2 1 SQL> ... a straightforward GREATEST() call will give the desired result: SQL> select name 2 , greatest(m1,m2,m3,m4) 3 from your_table 4 / NAME GREATEST(M1,M2