Omit Results - Two Tables That Each Have A Status Field?
Aug 6, 2010
I'm trying to leave out results of a query that match certain conditions, basically I'm looking at two tables that each have a status field. If the status of both is equal to zero then I want the result to be left out of the search results. I'm struggling with the logic though. In the where clause I've tried:
(ACCO.STATUS != '0' AND CCO.STATUS != '0')
this, however, omits everything where the status combination isn't 1 and 1. I've also tried:
(
(ACCO.STATUS = '1' AND CCO.STATUS = '1') OR
(ACCO.STATUS = '1' AND CCO.STATUS = '0') OR
(ACCO.STATUS = '0' AND CCO.STATUS = '1')
)
but this does not work either.
View 6 Replies
ADVERTISEMENT
Feb 26, 2008
I need to select a count of records where a field (call it widget) is the same, so i need all records where widgets are distinct. So it would be like asking for a distinct in a where clause. Not having much SQL experience this is a difficulty for me.
lets see .. so a count of records where widget = widget or something along those lines.
View 9 Replies
View Related
Nov 11, 2010
I'm trying to select from table "A" where value1 and value2 match. If the values are not in table "A", try table "B". If the values exist in BOTH tables - only look at the results from table "A".
Table "A" may or may not have "new" data coming into the system.
Table "B" may or may not have "existing" data.
The code I am writing needs to find the "newest" data row for value1 and value2. Eventually the data in table "A" gets "Merged" into table "B" further on in the process.
Supposedly this can be done in a single query using a left outer join and the NVL function, but the person I inherited this from isn't available.
I've been able to get the row back if it exists in "A" or "B", but end up with two rows or no rows if the row exists in both... Arrrg...
View 9 Replies
View Related
Dec 18, 2012
I have created a simple function in database that take 2 arguments, the last one is optional.
Now i call the function in Forms 6i PL/SQL Trigger and omitt the default (optional) parameter the form builder crashes when i compile the form (CTRL + SHIFT + K)
i have tried to used both words "DEFAULT" and ":=" in the function's signature for making an optional argument.
View 1 Replies
View Related
Jul 16, 2012
Example Tables and Data:
I have 5 Courses, each course has 2 assignments.
with Courses as (
select 100 courseID from dual union all
select 200 from dual union all
select 300 from dual union all
select 400 from dual union all
select 500 from dual
), Assigns as (
[code]...
I need each assignment to get a color assigned to it according to it's courseID. So my theory is that I'd have a temporary table with a list of colors; each courseID would get assigned a color but my question is how do I assign each courseID a color without anything to join the temporary table on? Once each courseID has a color, I'd join in Assigns so that each assignment has a color associated with it according to it's courseID.
--Color table with 6 colors
with Colors as (
select 'red' color from dual union all
select 'blue' from dual union all
select 'yellow' from dual union all
select 'green' from dual union all
select 'purple' from dual union all
select 'teal' from dual
)
View 8 Replies
View Related
Sep 10, 2012
I have two master tables , one is supplier master and the other customer, the requirement is , i will pass a code as IN parameter and the result it should bring the appropriate name of that code , for example if i pass a code which exists in supplier master , it should get me the supplier name for that code , if i pass code which exists in customer ,it should bring customer name.
CREATE TABLE OM_CUST (CUST_CODE VARCHAR2(30),CUST_NAME VARCHAR2(240));
INSERT INTO OM_CUST VALUES ('1001','CUST1');
INSERT INTO OM_CUST VALUES ('1002','CUST2');
CREATE TABLE OM_SUPP (SUPP_CODE VARCHAR2(30),SUPP_NAME VARCHAR2(240));
INSERT INTO OM_SUPP VALUES ('2001','SUPP1');
INSERT INTO OM_SUPP VALUES ('2002','SUPP2');
View 6 Replies
View Related
Mar 19, 2007
I am attempting to update a single field in one table based on a select from two tables. However, I am receiving the following error.
ORA-00933: SQL command not properly ended
The sql I am using is as follows:
update PS_TRNS_CRSE_DTL
set RQMNT_DESIGNTN = 'TRN'
FROM PS_TRNS_CRSE_DTL A, PS_STDNT_CAR_TERM B
where (SELECT A.EMPLID, A.ACAD_CAREER, A.INSTITUTION, A.MODEL_NBR, A.ARTICULATION_TERM, A.TRNSFR_EQVLNCY_GRP, A.TRNSFR_EQVLNCY_SEQ, A.TRNSFR_STAT, A.GRADING_BASIS, A.RQMNT_DESIGNTN, B.STUDY_AGREEMENT
FROM PS_TRNS_CRSE_DTL A, PS_STDNT_CAR_TERM B
[code]......
View 6 Replies
View Related
Oct 1, 2011
Once I add an extra column to link the two tables the number of rows is reduced by one, however when I try to get this extra record I find none matching the same criteria that led to reducing the records.
SQL> SELECT count(*)
2 FROM N_CONTRACT NC, N_WITHDRAWAL_REQUEST NWR
3 WHERE NC.fk_temP_withdrawal_req_serial = NWR.SERIAL_NUMBER;
COUNT(*)
----------
2243
[code]...
View 3 Replies
View Related
Jun 17, 2013
i've following code
declare
i INTEGER:=0;
flag boolean:= FALSE;
vcInsert:='INSERT INTO CRM_DELT_IMPORT (';
if length(i_vcColumn1) > 0 then
flag:=TRUE;
[code]....
i am fetching data from excel all data is of general type, here i am passing value is VTDATE varchar2(100) but actual database column filed is DATE , How can i pass '13-06-13 05:54:33' to database table.
if i put this condition
vcInsert:=vcInsert|| ','||''''||i_ldata(i).to_char(VTDATE,'DD-MM-RR HH12:MI:SS')
i get the error
to_char must be declare.
if i remove this line
i am getting this error ORA-01843: not a valid month
View 8 Replies
View Related
Apr 23, 2010
Even though i am using COL1 CHAR(500) NULLIF COL1=BLANKS, then also i am getting same error for those columns.
View 13 Replies
View Related
May 3, 2013
I have a table where i need to update one field values based on another field of the same table , simply as it is.I have done this using one select all check box , on clicking that all check boxes of item_trans table will get selected , then i will un select some of check box and then using one button, i will update the value of the fields which are checked only.
I have put the sample code but when i am updating its taking long time and hanging.I am also attaching the form based on the test case provided.
--tables with insert statement
create table item_trans (trans_item varchar2(12),trans_qty number,trans_act_qty number)
insert into item_trans(TRANS_ITEM,TRANS_QTY,TRANS_ACT_QTY) VALUES ('TREE1',40,NULL);
insert into item_trans(TRANS_ITEM,TRANS_QTY,TRANS_ACT_QTY) VALUES ('TREE2',20,NULL);
insert into item_trans(TRANS_ITEM,TRANS_QTY,TRANS_ACT_QTY) VALUES ('TREE3',20,NULL);
--i want to set the value of trans_Act_qty as trans_qty
--i create one dummy or test block to keep the select all check box. for that table test script is
CREATE TABLE TEST
(
C VARCHAR2(2000 BYTE),
B NUMBER,
A NUMBER
);
insert into test (C,B,A) values ('A',1,1);
--code written in select all check box which is created on test.block.
BEGIN
GO_BLOCK('item_trans');
FIRST_RECORD;
LOOP
:M_END_YN := :M_END_ALL;
[code].......
--code written in M_END_YN ( actual check boxes where i will uncheck).
IF :M_END_YN = 'N' THEN
:M_END_ALL := 'N';
END IF;
--code written on button to update those values which are checked.
BEGIN
GO_BLOCK('item_trans');
FIRST_RECORD;
LOOP
IF :M_END_YN = 'Y' THEN
[code]......
View 5 Replies
View Related
May 9, 2013
I am New to Apex. Im using Apex Version 4.2.
I have a tab named APPROPRIATIONS it has 10 fields. Among which is PROJECT NUMBER, AUTHORIZAION DATE (CALENDER TYPE POPUP), And FUNDS CHECK FLAG.
The Scenario is depending upon PROJECT NUMBER the Fields are Populated including FUNDS CHECK FLAG .
But the AUTHORIZAION DATE is a MANDATORY field has to be filled by User
The Requirement is to make AUTHORIZAION DATE as MANDATORY only when the FUNDS CHECK FLAG is *"BLANK "* or *āYā*
If the FUNDS CHECK FLAG is *āNā* then the AUTHORIZAION DATE to be made OPTIONAL.
View 2 Replies
View Related
Apr 23, 2009
I need to update a field with the 1st 9 characters of another field in the same record.
View 1 Replies
View Related
Nov 14, 2011
I have a table called Customer_Type with following fields
Customer_type ,Active_date, Inactive_date
regular,11/01/2011
daily,11/04/2011
monthly,11/05/2011/11/11/2011
Tbale 2:Customer
Customer_name,Customer_type,Customer_Inactive_date
John,regular,
James,monthly,
Jake,daily,
Jill,monthly
What i wnat is to update the Customer_inactive_date with the Incative_date field from Customer_type based on their Customer_type... So james and Jill would have their rows updated in this scneario ..How can i achive this in pl/Sql
I have teh code using merge function..I want something in traditional old fashion..
The sql statements are below
CREATE TABLE CUSTOMER_TYPE
(
type_code VARCHAR2(10),
[Code]....
View 5 Replies
View Related
Nov 2, 2010
I delete member logfile from disk with statement: shred -fu /u01/app/oracle/redologs/activeredolog/DB1/redo0102.log
But if I check status one logfile with statement:
select status from v$logfile wheremember='/u01/app/oracle/redologs/activeredolog/DB1/redo0102.log';
Status is still null. I think status should be change.
My database is 11.2.0.1 with single instance.
Status is changed after restart instance.
Haw can I monitor status logfiles without restart instance?
View 2 Replies
View Related
Mar 27, 2013
Im looking for a query which returns the batch for which all the child should either be in 'A_STATUS','B_STATUS' or 'C_STATUS'. In this query im expecting a query which returns batch 2,3 and 4.
create table batch (batchid number);
insert into batch values(1);
insert into batch values(2);
insert into batch values(3);
insert into batch values(4);
[Code]...
View 9 Replies
View Related
Jun 2, 2011
i am migrating forms 6i to 10g, when i compile one form to checking purpose all are successfully fine but the record status bar not showing there fore message are not appear how to solve this problem
View 1 Replies
View Related
Sep 11, 2010
I have a clients table called CLIENTS. One of the fields in this table is called 'status'
I need to set this status field, depending on if the transactions for this client have passed.
The transactions are in a table called TXNS and has fields
client_id, txn_id, txn_status
txn_status can be 'success' or 'failed'
I need to somehow set the overall 'status' field on CLIENTS to success or fail depending on if any transactions failed or not
So for every client I want to list the status, any query that can possible list the overall status for the client?
select client_id, MAX(status)
from txns
group by client_id
but the max(status) bit needs to get the overall status part
View 10 Replies
View Related
Feb 23, 2012
I'm looking for a way to get continuous dates as a period in the result.My tabledata contains a date and a status, I want to get continuous dates with the same status value.
That's my tabledata:
select * from (
select to_date('01022012', 'ddmmyyyy') as thedate, 1 as status from dual
union select to_date('02022012', 'ddmmyyyy') as thedate, 1 as status from dual
union select to_date('03022012', 'ddmmyyyy') as thedate, 2 as status from dual
[code]...
THEDATE STATUS
---------- ------
01.02.2012 1
02.02.2012 1
03.02.2012 2
04.02.2012 1
05.02.2012 1
[code]...
And that's the result I am looking for:
select * from (
select to_date('01022012', 'ddmmyyyy') as startdate,
to_date('02022012', 'ddmmyyyy') as enddate from dual
union select to_date('04022012', 'ddmmyyyy') as startdate,
[code]....
View 6 Replies
View Related
Feb 24, 2010
I've got a pl/sql procedure that i would like to monitor its progress. Its been running for quite a few hours now and i dont really know if it is stuck in a loop or if it is just taking too long read/execute queries. Is there a way to find out what is the status of the procedure? or what it is currently doing?
I looked at views like v$sessions or v$session_longops but they dont actually tell me what it is currently doing. All of them just point to the call to the pl/sql procedure. Also, is it possible to look at the physical files on the filesystem to know if there is actually any processing going on and files are being written to? Is this possible or a files written to only after a commit?
View 17 Replies
View Related
May 11, 2012
CREATE TABLE stud(id number,Status CHAR(1))
INSERT INTO stud values(10,'Y')
INSERT INTO stud values(10,'Y')
INSERT INTO stud values(10,'Y')
INSERT INTO stud values(10,'N')
[code]...
ID STATUS
10 Y
10 Y
10 Y
10 N
20 Y
[code]...
I want to display the out put the IDs which are having the status both 'Y' and 'N'The output should be
ID STATUS
10 Y
10 Y
10 Y
10 N
20 Y
20 N
20 N
View 12 Replies
View Related
Oct 31, 2012
We are upgrading 10.2.0.4 enterprise edition single instance to 11.2.0.3 enterprise edition single edition manually. What should the listener status while doing upgradation. This is my first upgradation project.
View 5 Replies
View Related
Jan 21, 2006
How to change the status of remote_login_password file!
View 14 Replies
View Related
Mar 10, 2011
create a procedure that will update the column status from active to closed after every two years.
View 4 Replies
View Related
Aug 23, 2011
Question:
How to find out the status of the import job(how much work is done, ETA), i have started the job few days back it still running on the server. i am using import not datapump, because i got the dump which took with export. DB version is 11.2.0.2.0
for datapump i know i can use the following queries, but these are not giving any output l think these are only for datapump
select sid, serial#, sofar, totalwork from v$session_longops;
select sid, serial# from v$session s, dba_datapump_sessions d where s.saddr = d.saddr;
View 1 Replies
View Related
Aug 6, 2010
how to change tablespace plugged_in =no status to yes
View 1 Replies
View Related
Jun 21, 2011
In one of the databases, we have created more temp tables as on commit preserve rows. but i want to change the on commit preserve rows to on commit delete rows as per application requirements.I have searched the google but i didnt find any alter scripts for it.?
View 1 Replies
View Related
Sep 7, 2011
I am manually committing the form by writing commit statement in key - commit trigger for some reason.
Everything is working fine. I want to display a message if some necessary fields are not filled properly, like if a user filled half table and mistakenly he press the commit button. Here I want to show him a message that you can't saved the data because the table is not completely filled.
View 17 Replies
View Related
Jan 25, 2013
create table test_exp (oid number, ioid number, status varchar2(20));
Below are the insert statements.
Insert into TEST_EXP (OID, IOID, STATUS) Values (1, 100, 'NEW');
Insert into TEST_EXP (OID, IOID, STATUS) Values (1, 101, 'DISCO');
Insert into TEST_EXP (OID, IOID, STATUS) Values (1, 102, 'CANCELLED');
Insert into TEST_EXP (OID, IOID, STATUS) Values (2, 103, 'NEW');
Insert into TEST_EXP (OID, IOID, STATUS) Values (3, 104, 'DISCO');
Insert into TEST_EXP (OID, IOID, STATUS) Values (4, 105, 'DISCO');
Insert into TEST_EXP (OID, IOID, STATUS) Values (4, 106, 'NEW');
Insert into TEST_EXP (OID, IOID, STATUS) Values (5, 107, 'NEW');
Insert into TEST_EXP (OID, IOID, STATUS) Values (5, 108, 'CANCELLED');
[code]...
Now my problem is we should fetch the data based on the below rules
If an OID contains 2 IOIDs for which there is a NEW and DISCO status attached, then fetch the 2 records
If an OID has only 1 of these status, then ignore the same
If an OID has none of the 2 status, then ignore the same.
The expected output will be like below:
OID|IOID|STATUS
1 |100 |NEW
1 |101 |DISCO
4 |105 |DISCO
4 |106 |NEW
View 4 Replies
View Related
Dec 2, 2011
If a session runs a query, the status will be inactive after completing the database call. I know this concept. But I just want to know what will be session status, if it running a procedure contains many select queries, DML quries and loop? Whether it will be active until procedure completes or it will be switching active and inactive?
View 3 Replies
View Related