Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to compare different values of same column

User_S9M3BJan 8 2023

Hi ,
I having two tables emp and type.
create table EMP(ID number(10), effective_date date);
EID Effective_date
--------------------
1 02/14/2023
2 02/15/2023
3 04/30/2023
4 03/24/2023
create table type(ID number(10),contract_type varchar2(1));
TID contract_type
-----------------------
1 P
1 S
1 P
2 S
2 S
3 P
3 S
4 S
I am looking for EID which is having contract type is 'S' in type table. (or emp table with effective date is greater than sysdate and only contract_type ='S' in the type table)
Actual result :
2
4
--------------------------------
My query is not giving the correct results.
select EID
from emp,type
where EID = TID
contract_type ='S'
effective_date >= sysdate
group by TID
having count(TID) >= 1;

This post has been answered by Solomon Yakobson on Jan 8 2023
Jump to Answer

Comments

So that everyone can understand the detail, please provide more info. For example:
Exactly which Forms and Database version are you using? Keep in mind the version number should include the complete number and not something like 11g, 12c. These are not version numbers.
You said you tried the above. What happens when you do? Does an unexpected value get returned? Does nothing happen? Is there an error? And so on...
Any other details about what you are doing and what you expect would be helpful.

user10991018

forms version is forms [32 Bit] Version 11.1.1.7.0 (Production)
oracle database version is
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

what i am trying to do is
insert the data in a temporary table when select a value using checkbox.
so i am storing the value in a comma separated global variable and when i check or uncheck the values should insert in my temp table.
i am using when checkbox changed trigger to select the multi record block rows

  1. eg.
    :global.empid = (120,121,134)
    :emp_chk = ('y','n','y')
    this should insert dynamically using forms_ddl in temp table.
    please advise
    thanks.
sgalaxy

Many 'should' but no 'what happens' when trying to execute the code you've written...

1 - 3

Post Details

Added on Jan 8 2023
13 comments
1,982 views