expdp query with multipal table
Hi, fields,
I am trying to export data from a table using query and get the error ORA-31693: Table data object could not load/unload. Help, please.
Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE Production 11.2.0.3.0
AMT for HP - UX: 11.2.0.3.0 - Production Version
NLSRTL Version 11.2.0.3.0 - Production
HP - UX tapp02 B.11.31 U ia64 0160996338 unlimited-license user
Settings file.
DIRECTORY = DME
LOGFILE = TABLE_PRURGE_TEST. JOURNAL
DUMPFILE = TABLE_PRURGE_TEST. DMP
SCHEMAS = TIZONE
INCLUDE = TABLE:-"IN(\'CMS_ITEM\')"-""
query ='TIZONE. CMS_ITEM:------"WHERE (ITEM_ID) IN (SELECT AN ITEM." ITEM_ID CMS_ITEM POINT, MASTER M, BASEEVENT B, RELITEM R, DOCRELITEM D, OUTPUTDOC O, OUTDOCDMS DMS WHERE M.KEY97 = B.MASTER_KEY AND B.KEY97 = R.EVENT_KEY AND R.KEY97 = D.KEY97 AND D.KEY97 = O.DOCRELITEM AND O.KEY97 = DMS. OUTPUTDOC AND TRIM (DMS. DMSID) = TRIM (POINT. "" (ITEM_ID) AND M.STATUS = "EXP")-""
Connected to: Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
With partitioning, OLAP, Data Mining and Real Application Testing options
Departure 'SYS '. ' SYS_EXPORT_SCHEMA_22 ': / * AS SYSDBA PARFILE = / uat_data/EXPDP_NIBTRD/exp_query.
Current estimation using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 12,02 GB
Object type SCHEMA_EXPORT/TABLE/TABLE processing
Object type SCHEMA_EXPORT/TABLE/CONSTRAINT/treatment
Object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS of treatment
Object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS treatment
ORA-31693: Table object «TIZONE» data "" CMS_ITEM "impossible to load/unload and being ignored because of the error:
ORA-00911: invalid character
Table main 'SYS '. "' SYS_EXPORT_SCHEMA_22 ' properly load/unloaded
******************************************************************************
Empty the files together for SYS. SYS_EXPORT_SCHEMA_22 is:
/ uat_data/EXPDP_NIBTRD/TABLE_PRURGE_TEST. DMP
Job 'SYS '. "" SYS_EXPORT_SCHEMA_22 "completed with error (s 1) at 22:42
286067 Yes you are right. It is not required to escape quotes in files param. Problem solved I tried to game birds and it works. Thank you all for the support.
dumpfile = TABLE_PRURGE_TEST.dmp
logfile = TABLE_PRURGE_TEST.log
tables is TIZONE. CMS_ITEM
Query = TIZONE. CMS_ITEM: "WHERE ITEM_ID IN (SELECT AN ITEM." TIZONE ITEM_ID. CMS_ITEM POINT, TIZONE. MASTER M, TIZONE. BASEEVENT B, TIZONE. RELITEM R, TIZONE. DOCRELITEM D, TIZONE. OUTPUTDOC O, TIZONE. DMS OUTDOCDMS WHERE M.KEY97 = B.MASTER_KEY AND B.KEY97 = R.EVENT_KEY AND R.KEY97 = D.KEY97 AND D.KEY97 = O.DOCRELITEM AND O.KEY97 IS DMS. OUTPUTDOC AND TRIM (DMS. DMSID) = TRIM (POINT. ITEM_ID) AND M.STATUS! = "EXP")"
Tags: Database
Similar Questions
-
Hello
I want to run the table several queries. I have 4 tables. Table 1 is to have relatively in table 2, but table 3 & 4 is not related with table 1. wherever I want to extract the data from table 1, table 4. My current query works well but it miss the Chronogram of table 1, which records do not exist in table 2, where, from table 2 of table 4 its working fine.
SELECT z.productcode, fabqty z.productionadviceno, sum (z.fabricatedqty).
Fabqtynoms Round (Sum(z.fabricatedqty*.015) + Sum (z.fabricatedqty)),
w.workorderno, ons min (w.ons).
((SOMME (w.qtyinsheets) * min (ons))) PCS,
(SELECT SUM (NVL (mrnqty, 0)))
OF CANMRN
WHERE workorderno = w.workorderno) mrnqty;
(SELECT ROUND (SUM (NVL (ptnqty, 0))))
OF CANPTN
WHERE workorderno = w.workorderno
) ptnqty
OF CANWORKORDER w, productionadvice z
where w.productionadviceno = z.productionadviceno
and w.productcode = 501001
GROUP BY w.workorderno, z.productionadviceno, z.productcode
PRODUCTCODE PRODUCTIONADVICENO FABQTY FABQTYNOMS WORKORDERNO ONS SCP MRNQTY PTNQTY
----------- ------------------ --------- ---------- ----------- --------- --------- --------- ------
501001 20004182 250000 253750 20001805 15 253755 16917 253755
501001 20004229 200000 203000 20001817 15 202995 13533 202995
501001 20004251 130000 131950 20001829 15 131955 8797 131955
501001 20004256 200000 203000 20001839 15 202995 13533 202995
501001 20004277 500000 507500 20001844 15 507495 33833 507495
501001 20004411 500000 507500 20001918 15 507495 31619 474285
501001 20004904 230000 233450 20002150 15 233445
I want to get this record also is missing after you run the query, as I had mentioned w.productionadviceno = z.productionadviceno due to which its does not, how, in a delicate way, we can use this relationship.
501001 20004905 10000 10150
Sandy
use of EXTERNAL JOINS as follows
where w.productionadviceno = z.productionadviceno (+)
above is a left outer join. A LEFT OUTER JOIN is a JOIN operations that allow you to specify a join clause. He keeps the lines without correspondence of the first (left) table, join them with a NULL row in the form of the second table (right).
More details: LEFT OUTER JOIN operation
-
recursive query with two tables
Hello
Im having problems of recursive query construction and add to select the list to see the result in hierarchical mode, so I want to your advice.
I have two tables:
And I want to see the result like this:TABLE: t1 c_id parent_id c_level 1 - 1 2 1 2 3 1 2 4 - 1 5 4 2 6 5 3 TABLE: t2 c_id c_name 1 name1 2 name2 3 name3 4 name4 5 name5 6 name6
-Name1
-name2
-Name3
-Name4
-Name5
-name6
Could you please help me with this?
Or maybe can you provide good links where I can find solution how to SELECT LIST looks like the hierarchical tree?Here is my test scenario:
CREATE TABLE t1( c_id NUMBER, parent_id NUMBER, c_level NUMBER); CREATE TABLE t2( c_id NUMBER, c_name VARCHAR2(10)); INSERT INTO t1 VALUEs(1,NULL,1); INSERT INTO t1 VALUEs(2,1, 2); INSERT INTO t1 VALUEs(3,1, 2); INSERT INTO t1 VALUEs(4,NULL,1); INSERT INTO t1 VALUEs(5,4, 2); INSERT INTO t1 VALUEs(6,5, 3); INSERT INTO t2 VALUEs(1,'name1'); INSERT INTO t2 VALUEs(2,'name2'); INSERT INTO t2 VALUEs(3,'name3'); INSERT INTO t2 VALUEs(4,'name4'); INSERT INTO t2 VALUEs(5,'name5'); INSERT INTO t2 VALUEs(6,'name6'); SELECT LPAD('-',2 * a.c_level,'-') || b.c_name the_tree FROM t1 a, t2 b WHERE b.c_id = a.c_id CONNECT BY a.parent_id = PRIOR a.c_id START WITH a.parent_id IS NULL;
and the result:
THE_TREE ---------- --name1 ----name2 ----name3 --name4 ----name5 ------name6
I took the example you gave then perhaps your largest data set has the flaw?
Published by: SunDogCa on August 13, 2010 14:19
-
Recursive information, how to create a recursive query with a table?
Hello
I have some data from a table and is stored in the following way:
Building blocks
4040 x 1, x 3, x 4
4040 c3, c7, c9
4040 j5, j7,
4040 s8
4041 f4
4041 x 1, x 2, x 3
I need to record in another table component and all of its units in one line, like this
Component Total_units
4040 x 1, x 3, x 4, c3, c7, c9j5, j7, s8
4041 f4, x 1, x 2, x 3
I tried with subqueries, combination, and I can't get in a data record.
I really appreciate your help!
NicolasThe solution with xmlagg
Note: remove the end (en) this record 4040 j5, j7, manually
You can use the TRIM function to remove this as a GARNISH (end ',' units)WITH dat as (select 4040 Component, 'x1,x3,x4' Units from dual union all select 4040, 'c3,c7,c9' from dual union all select 4040, 'j5,j7' from dual union all select 4040, 's8' from dual union all select 4041, 'f4' from dual union all select 4041, 'x1,x2,x3' from dual ) SELECT Component ,TRIM (leading ',' from XMLAGG(XMLELEMENT(a,','||units).extract('//text()'))) col_name FROM dat GROUP BY component / COMPONENT COL_NAME ---------- ------------------------------------- 4040 x1,x3,x4,c3,c7,c9,j5,j7,s8 4041 f4,x1,x2,x3
SS
-
Update a query with two tables
CREATE TABLE T1
(
FIELD1 VARCHAR2 (10),
VALUE1 INTEGER,
FIELD2 VARCHAR2 (10),
INTEGER VALUE2
)
INSERT INTO T1 VALUES('OLD',100,'NEW',1000);
INSERT INTO T1 VALUES('OLD',200,'NEW',2000);
INSERT INTO T1 VALUES('OLD',300,'NEW',3000);
CREATE TABLE T2
(
DOMAIN VARCHAR2 (10),
AN INTEGER VALUE,
NAM VARCHAR2 (10)
)
INSERT INTO T2 VALUES('OLD',100,'ABC');
INSERT INTO T2 VALUES ('OLD', 200', 'ABC');
INSERT INTO T2 VALUES('OLD',600,'ABC');
INSERT INTO T2 VALUES('OLD',300,'XYZ');
There are currently some old values in table T2. But the current requirement is again present corresponding values in table T1 should be taken into account. A condition more is the NAM = 'ABC '.
I'm writing this way. Is to obtain target updated by several rows from the source. Please help sregard thi.
T2 UPDATE
SET A.FIELD = B.FIELD2, A.VALUE = B.VALUE2
T1 INNER JOIN T2 B
ON T2. VALUE = T1. VALUE1
AND T2. NAM = 'ABC '.
Concerning
KVBYou need something more to...
UPDATE T2 A SET (A.FIELD, A.VALUE)=(SELECT B.FIELD2,B.VALUE2 FROM T1 B WHERE A.VALUE=B.VALUE1) WHERE T2.NAM='ABC'
(not tested)
-
Create view opaque in OBIEE with multiple tables
Hello
I need assistance with the opaque view since I've never created in the past. I want to create an opaque view that retrieves data from several tables. Is it possible to do? Or y at - it another alternative available in OBIEE option? I read the blog following and other similar articles on views opaque but found no option to use for the query with several tables:
Oracle Business Intelligence: A physical layer to OBIEE 10 g Opaque View Creation
Also please advice how to join two tables from different databases in OBIEE?
Kindly advice.
Kind regards
Andy
Check also, it may be useful to you
http://obinsight.blogspot.com/2010/05/reporting-against-multiple.html
-
EXPORT DATAPUMP with query on a table
Hello
I would like to ask how to include a query in one parfile using EXPDP.
My statement is:
Select * from apt.sales where TO_CHAR (or_date, 'YYYY') = '2011';
My goal is to export only the GOLD (receipts) generated in 2011 in the table APT. SALES
My parfile is correct:
schemas = APT
Query = APT. SALES:'"where TO_CHAR(or_date,'YYYY') = '2011'" ' "
Directory = DATA_PUMP_DIR
dumpfile = ORin2011.dmp
logfile - ORin2011.log
I'm working on an Oracle 10.2.0.1 database in Windows Server 2003.
Help, please.Try to:
1 use the keyword TABLES otherwise all data schema is exported
2. use quoting easier for the QUERY parameter
3. use '=' for the LOGFILE parameterExample with the table HR. T on Windows:
tables=HR.T query=HR.T:"where TO_CHAR(x,'YYYY') = '2011'" directory=DATA_PUMP_DIR dumpfile=ORin2011.dmp logfile=ORin2011.log
C:\>expdp system/xxx parfile=et.par Export: Release 11.2.0.2.0 - Production on Mar. Oct. 18 08:17:36 2011 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production Starting "SYSTEM"."SYS_EXPORT_TABLE_01": system/******** parfile=et.par Estimate in progress using BLOCKS method... Processing object type TABLE_EXPORT/TABLE/TABLE_DATA Total estimation using BLOCKS method: 64 KB Processing object type TABLE_EXPORT/TABLE/TABLE Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS . . exported "HR"."T" 5.007 KB 1 rows Master table "SYSTEM"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded ****************************************************************************** Dump file set for SYSTEM.SYS_EXPORT_TABLE_01 is: C:\ORACLEXE\APP\ORACLE\ADMIN\XE\DPDUMP\ORIN2011.DMP Job "SYSTEM"."SYS_EXPORT_TABLE_01" successfully completed at 08:17:40
-
Querying the oracle table that has a column with the name of "FILE".
Hi all
I need to have an oracle table that has the column with the name "FILE".
I can query all columns with the query "select * from table".
But I'm not able to use the query "select the table file.
This table is converted from ms access to oracle and I need to have this column with the name "FILE".
Any suggestions?
Thank you
Abdellaoui
Hello
FILE is a keyword from Oracle, so it's not a good name,
Use FILEDATE, or DATE_FILED, or something else that is not in V$ RESERVED_WORDS. KEYWORD as the name column.
If you need to use the FILE, then you must use quotation marks.
-
I use the af: query with table to create a query, but the funny page, is in charge of the query page, the data contained in af:table are not fulfilled automatically. any idea, what the problem is?
Rgds!Hello
Do you use ViewCriteria to build your af:query with table, if yes, go to your ViewObject, then select your viewCriteria and click edit, and then open the data of the user interface tab, then check the query automatically . -
Write a SQL query with lines in columns
All the
I need help in writing a SQL query with lines in columns, let give u an example...
drop table activity;
CREATE TABLE 'ACTIVITY '.
(
"PROJECT_WID" NUMBER (22.0) NOT NULL,
VARCHAR2 (150 CHAR) "PROJECT_NO."
VARCHAR2 (800 CHAR) 'NAME '.
);
Insert in the ACTIVITY (PROJECT_WID, PROJECT_NO, NAME) values (1683691, '10007', 12-121');
Insert in the ACTIVITY (PROJECT_WID, PROJECT_NO, NAME) values (1684994, '10008', 12-122');
Insert in the ACTIVITY (PROJECT_WID, PROJECT_NO, NAME) values (1686296, '10009', 12-123');
Insert in the ACTIVITY (PROJECT_WID, PROJECT_NO, NAME) values (2225222, '9040', 12-124');
drop table lonet;
CREATE TABLE 'LONET.
(
VARCHAR2 (150 CHAR) "NAME."
NUMBER OF THE "ROOT."
VARCHAR2 (150 CHAR) "ENTRYVALUE".
);
INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ("GAC", 1683691, "LDE");
INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('NAM', 1683691, 'LME');
INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('BAG', 1683691, 'ICE');
INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('PAP', 1683691, 'IKE');
INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('NAM', 1686291, "QTY");
INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('PAP', 1686291, 'MAX');
INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ("GAC", 1684994, "MTE");
INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('PAP', 1684994, 'MAC');
INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('FMT', 1684994, 'NICE');
INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('FMR', 1684994, 'RAY');
INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('BAG', 1686296, "CAQ");
INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ("PAP", 1686296, "QAQ");
INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ("VANESSA", 1686296, "THEW");
INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ("ANDR", 1686296, "REYL");
commit;
Link: activity.project_wid = lonet.root
look like output
Project_wid Project_no NAME GAC NAM BAG RAC 1683691 10007 12-121 LDE LME LCE LKE 1684994 10008 12-122 MTE null null MAC 1686296 10009 12-123 null null CAQ QAQ 2225222 9040 12-124 null null null null two problems, in that I am running
1. I dono how simply we can convert rows to columns
2. for root = 1683691, there are double NAM and RAC in lonet table... ideally these data should not be there, but since its here, we can take a MAX so that it returns a value
3. There are undesirables who should be ignored
Once again my thought process is that we join the activity and 4 alias table lonet.
ask for your help in this
Thank you
Hello
This is called pivoting.
Here's a way to do it:
WITH relevant_data AS
(
SELECT a.project_wid, a.project_no, b.SID
, l.name AS lonet_name, l.entryvalue
Activity one
LEFT OUTER JOIN lonet l.root = a.project_wid l
)
SELECT *.
OF relevant_data
PIVOT (MAX (entryvalue)
FOR lonet_name IN ("GAC" IN the gac
"NAM" AS nam
'BAG' IN the bag
"RAC" AS cars
)
)
ORDER BY project_wid
;
Output:
PROJECT_WID PROJECT_NO GAC NAM BAG RAC NAME
----------- ---------- ---------- ---------- ---------- ---------- ----------
1683691 12 - 10007 121 LDE LME LCE LKE
1684994 MAC MTE 10008 12-122
1686296 12 - 10009 123 QAC QAQ
2225222 9040 12 - 124
To learn more about swivel, see the FAQ in the Forum: Re: 4. How can I convert rows to columns?
Thanks for posting the CREATE TABLE and INSERT statements; It's very useful!
-
help me out with a query with an output that has own text.
help me out with a query with an output that has own text.
For example select name from tbl_name
Ben "is my name"-> should be the output
Hello
3cc59f7b-B8C1-4EFA-8385-e0d8720a689c wrote:
help me out with a query with an output that has own text.
For example select name from tbl_name
Ben "is my name"---> should be the output
Sorry, it is not clear what you want.
If the table contains only "Ben", then you can get the output above using a query like this:
SELECT name. '' my name is' ' AS name_plus
FROM tbl_name;
I hope that answers your question.
If this isn't the case, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements), and the results you want from this data.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum: https://forums.oracle.com/message/9362002#9362002
-
Can I do a query with a varchar2 or other inside OF?
How can I do a query with a Variable (varchar) inside OF?
example:
Select * from: var;
I received the error message: "invalid table name".
declare
n number;
table-name varchar2 (30): = "double";
Start
run immediately 'count (*) select "| table_name in n;
dbms_output.put_line (n);
end;
/
-
Importing data with impdp table with 3 new columns
Hello
Is it possible to import data with impdp in tables with 3 new columns?
Kind regards
William
To do this, I use this method:
Add the three columns in the source table and create the package:
CREATE OR REPLACE PACKAGE DATAPUMP_TECH_COLS
IS
FUNCTION SET_DML_DATE (p1 in TIMESTAMP)
BACK TO TIMESTAMP;
FUNCTION SET_DML_TYPE (p2 in VARCHAR2)
RETURN VARCHAR2;
FUNCTION SET_DML_SCN (p3 in NUMBER)
RETURN NUMBER;
END DATAPUMP_TECH_COLS;
/
CREATE OR REPLACE PACKAGE BODY SYS. DATAPUMP_TECH_COLS
IS
FUNCTION SET_DML_DATE (p1 in TIMESTAMP)
RETURNS THE TIMESTAMP
IS
BEGIN
SYSDATE RETURN;
END;
FUNCTION SET_DML_TYPE (p2 in VARCHAR2)
RETURN VARCHAR2
IS
BEGIN
RETURN ' ';
END;
FUNCTION SET_DML_SCN (p3 in NUMBER)
RETURN NUMBER
IS
BEGIN
RETURN 0;
END;
END;
/
Export a table with remap_data
expdp = TEMP_DIR PARALLEL = 8 TABLES directory is PIVOTMAT2. ACCTG_LINE LOGFILE = expdp_acctg.log = COMPRESSION STATISTICS ALL EXCLUDE =.
DUMPFILE = ACCTG1.dmp, ACCTG2.dmp, ACCTG3.dmp, ACCTG4.dmp, ACCTG5.dmp, ACCTG6.dmp, ACCTG7.dmp, ACCTG8.dmp REUSE_DUMPFILES = YES.
REMAP_DATA = PIVOTMAT2. ACCTG_LINE. DML_TYPE:SYS. DATAPUMP_TECH_COLS. SET_DML_TYPE.------
REMAP_DATA = PIVOTMAT2. ACCTG_LINE. DML_DATE:SYS. DATAPUMP_TECH_COLS. SET_DML_DATE.------
REMAP_DATA = PIVOTMAT2. ACCTG_LINE. DML_SCN:SYS. DATAPUMP_TECH_COLS. SET_DML_SCN
Import table
Impdp "" / as sysdba "" DIRECTORY = SRC_PIVOT TABLE_EXISTS_ACTION = TRONQUER REMAP_SCHEMA = PIVOTMAT2:STGPIV.
DUMPFILE = ACCTG1.dmp, ACCTG2.dmp, ACCTG3.dmp, ACCTG4.dmp, ACCTG5.dmp, ACCTG6.dmp, ACCTG7.dmp, ACCTG8.dmp PARALLEL = 8
to complete the removal of the collar if necessary.
-
Select the query with the level line list where the clause
Hi all
I am creating a tabular presentation based on a SQL query that has a list of selection based on a query with a where clause clause that refers to a column in the original SQL query.
The situation is, I have a table that stores the client_id, source_id, and build_id, lets call it client_source. I have a second table, build_source, containing source_id and build_id, one to many relations between the two (1 source_id could have build_id 1-7).
Using a tabular presentation, I want to select the correspondent build_id to use in client_source, but the selection list should contain only the build_id for this particular source_id of lines.
Here is an example of the SQL source of tabular presentation;
Select
s.ROWID,
s.CLIENT_ID,
s.SOURCE_ID,
APEX_ITEM. SELECT_LIST_FROM_QUERY (1, s.BUILD_ID,)
"Select display b.build_id, b.build_id return.
b build_source where b.source_id = s.SOURCE_ID ') lst
of s client_source
what I want to achieve, it's as source_id "BOLD" match fields. When the query is built this way, I get an error of "invalid identifier" Oracle on s.SOURCE_ID during execution.
Is there some special tags to be used to refer to the external column? I must be missing something because this looks like a pretty mundane problem.
I am running on 4.1.0.00.32, on an Oracle 10 g release 10.2.0.4.0 Server Express request.
I look forward to useful responses!
See you soon,.
Jason
Published by: 1005131 on May 9, 2013 19:02Your selection by query list receives a static SQL. That SQL can't "see" the value of your s.source_id.
But it would work like this:
where b.source_id = ' | s.SOURCE_ID)You would be the value for the SQL concatenation. It is not ideal, but it will work.
Jorge
-
SQL query with terms and calculations?
Hello
How do I create a query with terms and calculations?
For example, I have this table
Start | End | At work | Mandatory
------------------------------------------------------------------------------------
1ST JANUARY 13 | JANUARY 11, 13. Office | 1
JANUARY 14, 13. 25 JANUARY 13 | Ministry of the Interior. 0
04-MRZ-13 | 15-MRZ-13 | Office | 0
FEBRUARY 11, 13. FEBRUARY 22, 13. Office | 1
Now, if the workplace of the column = office and required column = 0
the new 'price' column should calculate: (end-start) * $25.00
and if workplace = Office and required column = 1
the 'price' column must calculate: (end-start) * $20.60
any other $0.00
I tried with the case statement, but I didn't know how
to calculate my values and display in the virtual column 'price '.
Something like
case
When Working_Place = 'Office' and mandatory = 1
then...
else ' 0.00'. "
end PRICE
?????
Or is that not possible?
Published by: DB2000 on 12.03.2013 05:09Use CASE:
select start_dt, end_dt, working_place, mandatory, case when working_place = 'Office' and mandatory = 0 then (end_dt - start_dt) * 25 when working_place = 'Office' and mandatory = 1 then (end_dt - start_dt) * 20.60 else 0 end price from tbl / START_DT END_DT WORKING_PLA MANDATORY PRICE --------- --------- ----------- ---------- ---------- 01-JAN-13 11-JAN-13 Office 1 206 14-JAN-13 25-JAN-13 Home Office 0 0 04-MAR-13 15-MAR-13 Office 0 275 11-FEB-13 22-FEB-13 Office 1 226.6 SQL>
SY.
Maybe you are looking for
-
Photos newly imported not projection in «Moments', just «all Photos»
I get this problem since I started using my new camera (a Sony RX100 III) - when I import photos to iPhone using PlayMemories they do not appear in 'Moments', but do appear in 'All the Photos' and download and synchronize with iCloud. This didn't hap
-
LaserJet pro 400 color: Blue lines on the right side of the page when printing in color
When printing in color I get this blue line that occurs on the right side of the page. It is darkest near the edge and shoot low towards the printed part of the document. It is a vertical line that follows the entire length of the page. I printed a r
-
I'm looking for the incoming information before secure lock icon and the password. Where is the icon?
-
Tap and highlight does not work
Hey, I hope you can help me with the following problem: In system preferences, there is the possibility to switch on ' tap to click on ' or something like that. I would like to have this option so that I don't have to press the trackpad physically. Y
-
HP Officejet Pro 8600 more won't copy even after hard reset
HP Officejet Pro 8600 Plus the Windows 8 operating system Will be printed computer; you scan documents & save on computer. will NOT be printed on the device. Stop printer; unplugged from the wall and the back of the unit. holding the power button for