Need help to write a sql
Hi allI have a table with 2 fileds, say Patch, Applied_date
Table example is below:
Patch Applied_date
==================
111 1 January 10
222 1st February 10
333 1 March 10
444 2 January 10
555 1st January 12
666 3 January 10
I want a query to display the output as below.
I have search for "where patch in (111,222,777,888).
I expect the output to be
patch Applied_date
================
111 1 January 10
222 1st February 10
777 not applied * 777 is not in the table, I want the applied to the display a date not applied *.
not applied 888 * 888 dosent column exists in the table, even in this case I want in the result and its
column (Applied_date) corresponding apply do not.
Can someone write a sql to do this.
I can write a PL/SQL. I want a sql.
Thank you
Prasad
Published by: user13062453 on February 18, 2012 12:10
Create list of patches in a table and use an outer join:
with patch as (
select 111 patch,to_date('1-Jan-10','dd-mon-rr') applied_date from dual union all
select 222,to_date('1-Feb-10','dd-mon-rr') from dual union all
select 333,to_date('1-Mar-10','dd-mon-rr') from dual union all
select 444,to_date('2-Jan-10','dd-mon-rr') from dual union all
select 555,to_date('1-Jan-12','dd-mon-rr') from dual union all
select 666,to_date('3-Jan-10','dd-mon-rr') from dual
),
list as (
select 111 patch from dual union all
select 222 from dual union all
select 777 from dual union all
select 888 from dual
)
select l.patch,
nvl(to_char(p.applied_date,'dd-Mon-yy'),'Not applied') applied_date
from patch p
right join
list l
on l.patch = p.patch
/
PATCH APPLIED_DAT
---------- -----------
111 01-Jan-10
222 01-Feb-10
777 Not applied
888 Not applied
SQL>
SY.
Tags: Database
Similar Questions
-
Need help to write a SQL query complex
I have the source tabe as below
-> SOURCE_TABLE
I want to load as target table belowNAME CUST_ID SVC_ST_DT SVC_END_DT TOM 1 31/08/2009 23/03/2011 DOCK 2 01/01/2004 31/05/2010 HARRY 3 28/02/2007 31/12/2009
-> TARGET_TABLE
Is it possible to write a SQL query that returns the data in the same way above the target table.NAME CUST_ID SVC_ST_DT SVC_END_DT TOM 1 31/08/2009 31/12/2009 TOM 1 01/01/2010 31/12/2010 TOM 1 01/01/2011 23/03/2011 DOCK 2 01/01/2004 31/12/2004 DOCK 2 01/01/2005 31/12/2005 DOCK 2 01/01/2006 31/12/2006 DOCK 2 01/01/2007 31/12/2007 DOCK 2 01/01/2008 31/12/2008 DOCK 2 01/01/2009 31/12/2009 DOCK 2 01/01/2010 31/05/2010 HARRY 3 28/02/2007 31/12/2007 HARRY 3 01/01/2008 31/12/2008 HARRY 3 01/01/2009 31/12/2009
Published by: AChatterjee on April 30, 2012 07:14
Published by: AChatterjee on April 30, 2012 07:14Or like this...
SQL> ed Wrote file afiedt.buf 1 with t as (select 'TOM' as NAME, 1 as CUST_ID, date '2009-08-31' as SVC_ST_DT, date '2011-03-23' as SVC_END_DT from dual union all 2 select 'DOCK', 2, date '2004-01-01', date '2010-05-31' from dual union all 3 select 'HARRY', 3, date '2007-02-28', date '2009-12-31' from dual) 4 -- 5 -- end of test data 6 -- 7 select name, cust_id, svc_st_dt, svc_end_dt 8 from ( 9 select name 10 ,cust_id 11 ,greatest(svc_st_dt, add_months(trunc(svc_st_dt,'YYYY'),yr*12)) as svc_st_dt 12 ,least(svc_end_dt, add_months(trunc(svc_st_dt,'YYYY'),(yr+1)*12)-1) as svc_end_dt 13 from t 14 cross join (select rownum-1 as yr 15 from dual 16 connect by rownum <= (select extract(year from max(svc_end_dt)) - extract(year from min(svc_st_dt)) + 1 from t) 17 ) 18 ) 19 where svc_st_dt <= svc_end_dt 20* order by 2, 3 SQL> / NAME CUST_ID SVC_ST_DT SVC_END_DT ----- ---------- -------------------- -------------------- TOM 1 31-AUG-2009 00:00:00 31-DEC-2009 00:00:00 TOM 1 01-JAN-2010 00:00:00 31-DEC-2010 00:00:00 TOM 1 01-JAN-2011 00:00:00 23-MAR-2011 00:00:00 DOCK 2 01-JAN-2004 00:00:00 31-DEC-2004 00:00:00 DOCK 2 01-JAN-2005 00:00:00 31-DEC-2005 00:00:00 DOCK 2 01-JAN-2006 00:00:00 31-DEC-2006 00:00:00 DOCK 2 01-JAN-2007 00:00:00 31-DEC-2007 00:00:00 DOCK 2 01-JAN-2008 00:00:00 31-DEC-2008 00:00:00 DOCK 2 01-JAN-2009 00:00:00 31-DEC-2009 00:00:00 DOCK 2 01-JAN-2010 00:00:00 31-MAY-2010 00:00:00 HARRY 3 28-FEB-2007 00:00:00 31-DEC-2007 00:00:00 HARRY 3 01-JAN-2008 00:00:00 31-DEC-2008 00:00:00 HARRY 3 01-JAN-2009 00:00:00 31-DEC-2009 00:00:00 13 rows selected.
-
Need help to write the SQL query
Hello
Please help me to write a query. My requirement is as below.
Hello
I have a table say XYZ in the following format.
product_id local min_order_quntity
========================================
1 en 10
1 ch 10
2 en 20
2 ch 20
3 en 30
3 ch 30
4 en 40
4 NC 10
Now I want to find the product_id where min_order_quantity is different for cn and locale
now I want the result of the following
product_id local min_order_quantity
=============================================
4 en 40
4 ch 10
This is different for local in and cn for product_id 4 min_order_quantity
min_order_quantity should be the same for both the locale(en,ch) for any product_id.
I want to find the product_id where min_order_quantity is different for ch and fr local
Thank you..Hello
This query should do the job
select * from xyz t1 where exists ( select 1 from xyz t2 where t2.product_id = t1.product_id and t2.locale != t1.locale and t2.min_order_quantity != t1.min_order_quantity );
See you soon
-
I need help to write a script that detects the first instance of a paragraph style and then change
I need help to write a script that detects the first instance of a paragraph style and then he goes to a different paragraph style. I don't necessarily need someone to write all this, by the biggest problem is to find how to find just the first instance of the paragraph style. Any help would be greatly appreciated, thank you!
Hello
then try this with your active doc:
....................
myDoc var = app.activeDocument;
mStyle var = myDoc.paragraphStyles.item ("PS_NameToFind"); change the name to paraStyle
var mStyle_1 = myDoc.paragraphStyles.item ("PS_NameToChange"); change the name to paraStyle
var mFrames = myDoc.pages.everyItem ().textFrames.everyItem () .getElements ();
app.findTextPreferences = null;
app.findTextPreferences.appliedParagraphStyle = mStyle;
for (var k = 0; k)< mframes.length;="">
{
currFound = mFrames [k] .findText ();
If (currFound.length > 0)
currFound [0] .paragraphs [0] .appliedParagraphStyle = mStyle_1;
}
app.findTextPreferences = null;
................
Rgds
-
Need help to write a sub query
Our environment - Oracle 10 g
Hi all
Need help to write a sub query to reach him here are examples of data using which iam trying to replace the value column in the table based on two other columns in the same table
Examples of data
ClaimNo flag LineNo Procedurecode
100 01 N MN4567
100 02 Y 7863
100 03 N MN8976
100 04 Y 9000
101 01 Y 8954
101 02 N MN6754
101 03 N MN7654
101 04 Y 8976
102 01 Y 1234
102 02 Y 2345
102 03 Y 3456
102 03 Y 4567
Each column of ClaimNo has several rows of data. But if column procedurecode for a claimNo starts with MN then all values associated with the claimno for the flag column should replace N
If the data must become like below
ClaimNo flag LineNo Procedurecode
100 01 N MN4567
100 02 N 7863
100 03 N MN8976
100 04 N 9000
101 01 N 8954
101 02 N MN6754
101 03 N MN7654
101 04 N 8976
102 01 Y 1234
102 02 Y 2345
102 03 Y 3456
102 03 Y 4567
Thank youSee the example:
with t as ( select 100 ClaimNo, '01' LineNo, 'N' Flag, 'MN4567' Procedurecode from dual union all select 100, '02', 'Y', '7863' from dual union all select 100, '03', 'N', 'MN8976' from dual union all select 100, '04', 'Y', '9000' from dual union all select 101, '01', 'Y', '8954' from dual union all select 101, '02', 'N', 'MN6754' from dual union all select 101, '03', 'N', 'MN7654' from dual union all select 101, '04', 'Y', '8976' from dual union all select 102, '01', 'Y', '1234' from dual union all select 102, '02', 'Y', '2345' from dual union all select 102, '03', 'Y', '3456' from dual union all select 102, '03', 'Y', '4567' from dual ) select claimno, lineno, flag, case when count(decode(substr(procedurecode,1,2),'MN',1)) over(partition by claimno)>0 then 'N' else flag end new_flag, procedurecode from t
Kind regards
Sayan M. -
Hi all
I need to write a sql that retrieves data from the status table and check for this time in the ESHIFT table if the flag was or not. If is there, then it will keep the record as it is Furthermore, there
did not understand at the time the flag was N suppose ESHIFT table has one record where you N 13:00:01-13:30 then the status register which is 13:00-13:59 min 59 s, we should get 13:00 - 13: records of 00:00 1 and 2 of 13:30:01-13:59 min 59 s
create table ESHIFT (From_date date, date, to_date, flag varchar2 (2));
insert into ESHIFT values (' 1 February 12 09:00 ", February 1, 12 13:20 ', 'Y');
insert into ESHIFT values (' 1 February 12 13:20:01 ", 1 February 12 13:30 ',' don't);
insert into ESHIFT values (' 1 February 12 13:30:01 ", February 1, 12 16:00 ', 'Y');
SELECT * from eshift;
create table status (date of From_date, to_date date, status number);
insert into values of status (1 February 12 11:00 ', February 1, 12 12:00 ', 1);
insert into values of status (1 February 12 12:00:01 ', February 1, 12 12:20 ', 2);
insert into status values ("1 February 12 12:20:01", 1 February 12 12:59:59 ', 1);
insert into status values ("1 February 12 13:00", February 1, 12 13:59:59 ', 1);
insert into status values ("1 February 12 14:00", February 1, 12 14:59:59 ', 2);
SELECT * STATUS;
In the case above should get sql
1 FEBRUARY 12 11:00 1ST FEBRUARY 12 12:00 1
FEBRUARY 1ST, 12 12:00 1ST FEBRUARY 12 12:20 2
FEBRUARY 1ST, 12 12:20:01, 1 FEBRUARY 12 12:59:59 1
FEBRUARY 1ST, 12 13:00 1ST FEBRUARY 12 13:20 1
FEBRUARY 1ST, 12 13:30 1 FEBRUARY 12 13:59:59 1
FEBRUARY 1ST, 12 14:00 1 FEBRUARY 12 14:59:59 2
It will be really great if someone can help me how I can get the desired result.
Thank you very much in advance.
Please provide instructions creating table and data. It makes it so much easier to answer.
I think you want:
Select (s.from_date, e.from_date) greatest from_date, less (s.to_date, e.to_date) to_date, s.status
s status e eshift join on s.from_date < e.to_date="" and="" s.to_date=""> e.from_date and e.flag = 'Y '.
order by 1
-
I am trying to write the SQL for a single recordset.
I have a table with all the info from the standard article and an item_colorID.
I have a table with 2 columns, item_colorID and color_ID color_lookup
I have a table with 2 columns, color_ID colors and color
I want to join the tables and filter it so that a repeat region shows dynamic data by the name of article, thumb, description, price
and also a dynamic list/menu populated by color
filtered so that each element is in the list/menu only available element colors.
I have tried different variations of this sql
SELECT * items INNER JOIN color_lookup ON color_lookup.item_colorID = items.item_colorID INNER JOIN colors ON colors.color_ID = color_lookup.color_ID WHERE items.itemCatID = 3 ORDER BY items.itemName
but the list/menu shows each color choice, multiplied by the number of items in this color
That is to say white will show 80 + times.
Thanks for your help,
Jim balthrop
Hi JB, I think I understand the situation, but of course, I'm not familiar with the interface of the cart software you are using. It seems that you will not be able to use the choice "research from the recordset" because the color is a different Recordset. You can't really understand the color in the main recordset because it would cause the main repeating region show the item once for each available color, which is not what you want.
I also see that the drop-down color is in its own form. If you have placed this process in the main form, would be the behavior recoginize it and treat it differently? In other words, the cart accepts entry options outside the main form element it uses:
I don't know that the shopping cart software contains other methods to add to the cart you can be forced to use.
What shopping cart software are you helping? They have a forum which you could get more targeted assistance?
-
A little help to write a SQL please? Maybe need some advanced features...
Hi all
I also write a SQL, code given in total and some rows in a table, can return the lines where a column is added to the total
These are operations, so I'm going to boil up to:
TranID, TranAmount
1, 100
2, 200
3, 250
4, 50
Suppose that I know that I must seek 2 transactions totaling 300.
Possible combinations are ID 1 + 2 or 3 + 4. In this case, it's a mistake that I can't find a single set of operations that meets the requirements of the number-and the sum - of
Suppose that I know that I must seek 3 transactions totalling 550.
Combination is ID 1 + 2 + 3
The difficulty for me here is the number of transactions were hunting will change, possibly without limits but it will be a factorial element in terms of number of combinations, imposing an upper limit would be appropriate.
I considered a solution in my understanding of SQL, I can take my lines, and (assuming I have apply a limit of 3 i.e. I can't watch for more than just a combination of 3 operations) cross to join them on their own to no tran ID is equal to any other ID tran I will then have a huge block of Cartesian joint operations. I can then use a where clause clause to choose combinations of lines having the correct sum. If I can use some kind of ID > otherID in my join, then I can do the Cartesian a triangle shape that hopefully would essentially prevent double rows of 1,2,3 and 1,3,2, 3,2,1 and 3,1,2 etc.
If I was looking for just 2 or 1 combinations, I would replace the tran with 0 amounts using a case when (because the number of times I'll join cross is fixed;) I don't want to get into dynamic sql execution)
Finally I would like to emphasize that I have do this in PL/SQL or possibly Java so I have the opportunity to introduce a custom so logic must be
I would be delighted to hear any other entry among the members of the sages and shriveled here as to how they can deal with this problem... Maybe oracle has some cool analytical features that I don't know who will help out here?
Thanks in advance guys n girls!CD / wrote:
Nocycle is really necessary?C.
Very good point cd. It was then that I was testing to try to get the answer, but in fact it is not necessary.
SQL> ed Wrote file afiedt.buf 1 with t as (select 1 as TranID, 100 as TranAmount from dual union all 2 select 2, 200 from dual union all 3 select 3, 250 from dual union all 4 select 4, 50 from dual) 5 -- end of test data 6 select distinct substr( trans 7 , decode( level, 1, 1, instr(trans,'+',1,level-1)+1) 8 , decode( instr(trans,'+',1,level), 0, length(trans), instr(trans,'+',1,level) - decode( level, 1, 0, instr(trans,'+',1,level-1))-1) 9 ) the_value 10 from (select trans 11 from ( 12 select ltrim(rtrim(comb.trans,'+'),'+') as trans, sum(case when instr(comb.trans,'+'||t.tranid||'+')>0 then tranamount else null end) as sum_tran 13 from (select sys_connect_by_path(tranid, '+')||'+' as trans 14 from t 15 connect by tranid > prior tranid) comb 16 ,t 17 group by comb.trans 18 ) 19 where sum_tran = 300) 20 connect by level < length(replace(translate(trans,'01234567890','00000000000'),'0')) + 2 21* order by 1 SQL> / THE_VALUE -------------------------------------------------------------------------------------------------------------------------------- 1 2 3 4 SQL>
-
Need help in writing the SQL CASE or DECODE statement
Hi experts,
I need to write a SQL select order_num, cntry_cde, prod_id and Qty by joining order_num on PROD_ORDER and PROD_ORDER_TXT.
Here is my sample data
PROD ORDER_
order_num Prod_id Qty cntry_cde
100 US A1 5
101 US 10 A2
102 IN A3 4
103 TO THE A4 9
104. IN A5 3
PROD ORDER_TXT_
cntry_cde Prod_id order_num
100 US A1
101 US A2
102 NZ A3
103 TO THE A4
A5 104
Here's the requirement,
(1) if the cntry_cde in PROD_ORDER is the same as cntry_cde in PROD_ORDER_TXT then select PROD_ORDER.cntry_cde (orders 100, 101, 103)
(2) if they are different, choose PROD_ORDER_TXT (order 102, to THE NZ <>) country code
(3) if they are different and PROD_ORDER_TXT.cntry_cde is null, I can't use it like cntry_cde in my report (order 104). It happenend just because of bad data to the source.
I can't avoid it. Then just use the cntry_cde of PROD_ORDER
Expected results
100 US A1 5
101 US 10 A2
102 NZ A3 4 - changed in NZ
103 TO THE A4 9
104. IN A5 3 - IN retained as PROD_ORDER_TXT.cntry_cde is null
instructions for creation and insertion of sample table are lower than
create the table prod_order
(number of order_num,
cntry_cde CHAR (2),
prod_id VARCHAR2 (6).
number of quantity)
create the table prod_order_txt
(number of order_num,
cntry_cde CHAR (2),
prod_id VARCHAR2 (6))
insert into prod_order values (100, 'WE', 'A1', 5);
insert into prod_order values (101, 'WE', 'A2', 1);
insert into prod_order values (102, ' to THE ', 'A3', 4);
insert into prod_order values (103, ' to THE ', 'A4', 9);
insert into prod_order values (104, 'IN', 'A5', 3);
insert into prod_order_txt values (100, 'WE', 'A1');
insert into prod_order_txt values (101, 'WE', 'A2');
insert into prod_order_txt values (102, 'NZ', 'A3');
insert into prod_order_txt values (103, ' to THE ', 'A4');
insert into prod_order_txt values (104, 'A5', NULL);
commit;
Thank you for your help in advance
Published by: manon March 28, 2012 13:39
-
Need help to write to Oracle and SQL Server in the Oracle triggering
We have a third which feeds data for us. Their client application feeds directly to some source tables in our Oracle database 10g. We have triggers on those tables that sort and treat lines as they come.
We have a new operation and try to write some of these incoming data now to a SQL Server database through heterogeneous services - essentially the same exact data in two databases. I have a related database that works very well for the selection, but I've never tried to write Oracle PL/SQL to write in a DB SQL Server 2008. My first attempt was met with the following error: "ORA-02047: impossible to join the current distributed transaction.
I found another thread where they say that the only way to do it is by using a stand-alone transaction, but they do not give an example. Here is the section of relaxation that I use:
Can someone point me to a way to accomplish this simple insertion?select to_char(new_date,'MM-DD-YYYY') into sql_txt from dual; insert into mancamp_location@sqlweb ("UnitID", "ManCampID", "Lat", "Long", "UpdateDT", "VehSpeed", "VehDirection", "Landmark") values (v_truck, f_unit, f_lat, f_long, sql_txt, f_spd, f_dir, f_ldmk);
An example of a standalone trigger is:
Suppose you have a table in Oracle:
CREATE TABLE emp_sal
(
EMPNO NUMBER 4,
SAL NUMBER (7.2));and a similar table in a SQL server:
SQL Server:CREATE TABLE emp_sal
(
EMPNO NUMERIC (4).
SAL NUMERIC (7.2));Then, you can create an insert trigger that replicates the data:
CREATE OR REPLACE TRIGGER dg4odbc_repl AFTER INSERT ON emp_sal
FOR EACH LINE
DECLARE
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
INSERT INTO 'emp_sal"@MSODBCSQLSERVER_DG4ODBC_EMGTW_1123_DB '.
VALUES (: new.empno,: new.sal);
COMMIT;
END;
/-Note the validation, otherwise risk of ORA-6519
When you now insert a record into the Oracle database:
insert into emp_sal values (1234, '1200,89');
the trigger is activated and inserts the record in SQL Server:
Select * from 'emp_sal"@MSODBCSQLSERVER_DG4ODBC_EMGTW_1123_DB;
EMPNO, SAL
----- -------
1234 1200.89It works fine when you post data insert, but as soon as restore you the insert only data Oracle will be cancelled - data will remain as long as the independent transaction dedicated to its SQL Server insert:
insert into emp_sal values (1384, '1200,89');
Rollback;
Select * from emp_sal;
EMPNO, SAL
----- -------
1234 1200.89Select * from 'emp_sal"@MSODBCSQLSERVER_DG4ODBC_EMGTW_1123_DB;
EMPNO, SAL
----- -------
1234 1200.89
1384 1200.89So I strongly recommend to use the DG4MSQL gateway which is able to participate in distributed transactions and allows validation/restore transactions.
DG4ODBC lie on OTN (http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html-online check out the "See all" link for your favorite platform), cloud of delivery of software Oracle (https://edelivery.oracle.com/) or "My Oracle Support". My Oracle support welcomes the latest version 11.2.0.3. In My Oracle Support goto patches and updates, then search for 11.2.0.3 data set Patch 10404530patch: 11.2.0.3.0 PATCH SET for ORACLE database SERVER, choose your preferred platform and see the Readme which CD contains the gateway software.
Published by: kgronau on April 24, 2012 08:44
-
Need help to write original Victorian SQL of a tricky requirement statement
Hello
I have a table with the following structure
ID Number (10)
Company Varchar2 (100)
Products Varchar2 (4000)
The area of the stored products the list separated by commas in the names of products, which the company deals in.
I want to know the number of companies for each product and organize the product list in descending order of their number
For example, the sample data as follows
The company produced ID
1 a readers of portable barcode of desktop computers, the readers of barcodes, computer laptop, system memory,
2B Handcrafted Wallets leather, holders of credit card in leather, handbag leather, ladies handbag, Designer handbag
C 3 laptops, desktops
4 d, leather wallet, handbag ladies
5 E ladies handbag, ladies, ladies Sandals boots
6 F designer handbag, handbag ladies
Now, here's the result I want
Nr. of companies article
Handbag ladies 4
Handbag designer 2
2 leather handbag
Laptop 2
Desktop computers 2
Memory system 1
1 barcode readers
1 portable barcode readers
1 hand-crafted leather wallets
1 leather credit card holders
Start ladies 1
1 ladies sandals
It would be great if I can achieve in a single SQL.
My database size is also great arround 1.5 million records and on an average about 10 produced by the company
Concerning
MaliceHello
[This thread | http://forums.oracle.com/forums/thread.jspa?threadID=717813&tstart=25] shows how to split a delimited (like your products column) parts list, one line per element.
There is a solution for Oracle 9. In Oracle 10 (and more) that the solution (using SUBSTR and INSTR) will still work, but I recommend to useREGEXP_SUBSTR ( products , '[^,]+' , 1 , n ) AS product
Instead, to get the item of the n - th from the products in the list separated by commas.
Once you have divided the column of the goods in parts, the main request is just
SELECT product , COUNT (*) AS no_of_companies FROM subquery GROUP BY product ORDER BY no_of_companies DESC , product;
-
Need help to write a better SQL query
Hi gurus,
Please let me know your best query for the problem below:
Suppose we have 2 tables in Oracle 10 G database:
IM1: product and warranty sales records
A: sales_id
B: product QTY.
C: quantity of product
D: Service QTY.
E: Service amount
IM1 table:
a b c d and e
-- -- ---- --- ---
1 1 100 1 10
2 1 150 1 70
3 2 500 1 100
4 1 100 0 0
IM2: brand and product guarantee service term associated with record sales
A: sales_id
G: the Service life
P: brand product of
Z: flag of product/Service
IM2 table:
a g p z
-- ---------- ----------- -----
1 sony NULL p
1 monthly NULL g
Dell 2 p, NULL reference
Reg 2 g NULL
NULL lenovo 3 p
3 monthly NULL g
Sony NULL 4 p
Then, he must bring the "term of Service" and "Brand product" in line with the sales table, as below:
ID h_qty h_amnt g_qty g_amnt brand term
-- ------- ----------- -------- ---------- --------- ----------
1 1 100 1 10 sony monthly
2 1 150 1 70 dell Reg
3 2 500 1 100 lenovo monthly
4 1 100 0 0 sony NULL
What I wrote myself is as below, but I want to know if there is a better idea to make the query more reliable, because real paintings are big and my query is slow.
SELECT DISTINCT
ID of the s.a,
s.b h_qyt,
s.c. h_amnt,
Virginia g_qty,
Sager g_amnt
brand of the PDP,
term of r.g
Of
(SELECT s.*, PDP FROM s im1, im2 p WHERE s.a = p.a. PDP AND IS NOT NULL).
IM2 p,
IM2 g
WHERE s.a. = p.a.
AND s.a. = g.a
AND (p.z = 'p' AND WINS = 'g')
OR (p.z = 'p' AND WINS = 'p' AND sagehomme = 0 AND s.p = pp)
ORDER BY 1;
Here you will find the table scripts:
create table im1 (a number, b, c number, number d, e number);
create table im2 (a number g char (10), char (10) p, z (1) tank);
insert into values im1 (1,1,100,1,10);
insert into values im1 (2,1,150,1,70);
insert into values im1 (3,2,500,1,100);
insert into values im1 (4,1,100,0,0);Insert in im2 values (1, null, 'sony', 'p');
Insert in im2 values (1, 'Monthly', null, 'g');
Insert in im2 values (2, null, 'dell', 'p');
Insert in im2 values (2, 'Reg', null, 'g');
Insert in im2 values (3, null, 'lenovo', 'p');
Insert in im2 values (3, 'Monthly', null, 'g');
Insert in im2 values (4, null, 'sony', 'p');something like below
Select x.a as id, x.b as h_qty, x.c as h_amnt, Eliane as g_qty, x.e as g_amnt, min (y.p) as min (y.g) as mark
-min (y.p) compared to (x.a partition) as min (y.g) on (x.a partition) as the term mark
of im1, im2 XY
where x.a = y.a
Group of x.a, x.b, x.c, Eliane x.eEdited: putting aggregation function instead of the function min min Analytics
-
Need help to write a program for the acquisition of signals.
Hello
I need to write a program that will do the following:
1 acquire two signals simulated,
2. make 10 averages the signal,
3. filter the signal,
4. display the signal in its raw form and the power spectrum (fft),
5. save the data using writing to the file vi
I tried it for awhile, but there's always something does not... None of the experts LabVIEW here can help me?
Thank you 1 million.
-Deet
No one here is going to do your homework for you. Please join what you have written so far and explain the specific problem that you are experiencing.
-
Need help: loop of pl/sql with UTL_FILE reading and analysis of file text 2
Hello, I am working on a new project using the UTL_FILE utility in oracle 11 g. and I was wondering if someone could help me with a pl/sql code, I can't understand.
My goal is to open and then read a Type_de_fichier file1.txt
copy a specific paragraph of the file1.txt where
the first word in a specific line in the file1.txt starts with "foo" then when the last word in fichier1.txt ends in 'ZEN'
write to file2.txt only the analysis section in my where statement.
I don't know if it's possible, but any guidance will greatly appreciate!
My code example:
CREATE OR REPLACE PROCEDURE my_app2 IS
Utl_file.file_type inFile;
OutFile utl_file.file_type;
buffer VARCHAR2 (30000);
BEGIN
-Open a file to read
InFile: = utl_file.fopen ('TEST_DIR', 'mytst.txt', 'r');
-Opens a file for writing
OutFile: = utl_file.fopen ('TEST_DIR', "Out.txt", "w");
-Check the file is open
IF utl_file.is_open (InFile) THEN
-lines in the file in loop
LOOP
BEGIN
UTL_FILE.get_line (InFile, buffer);
-Write to out.txt
UTL_FILE.put_line (OutFile, buffer, FALSE);
UTL_FILE.fflush (outfile);
EXCEPTION
WHEN NO_DATA_FOUND THEN
EXIT;
END;
END LOOP;
END IF;
UTL_FILE.fclose (INFILE);
UTL_FILE.fclose (outfile);
EXCEPTION
WHILE OTHERS THEN
RAISE_APPLICATION_ERROR (-20099, "UTL_FILE Unknown Error");
END my_app2l;
/Hello
According to the code should work-
CREATE OR REPLACE PROCEDURE my_app2 IS infile utl_file.file_type; outfile utl_file.file_type; buffer VARCHAR2(30000); b_paragraph_started BOOLEAN := FALSE; -- flag to indicate that required paragraph is started BEGIN -- open a file to read infile := utl_file.fopen('TEST_DIR', 'mytst.txt', 'r'); -- open a file to write outfile := utl_file.fopen('TEST_DIR', 'out.txt', 'w'); -- check file is opened IF utl_file.is_open(infile) THEN -- loop lines in the file LOOP BEGIN utl_file.get_line(infile, buffer); IF buffer LIKE 'foo%' OR b_paragraph_started THEN --write to out.txt utl_file.put_line(outfile, buffer, FALSE); b_paragraph_started := TRUE; END IF; IF buffer LIKE '%ZEN' THEN b_paragraph_started := FALSE; END IF; utl_file.fflush(outfile); EXCEPTION WHEN no_data_found THEN EXIT; END; END LOOP; END IF; utl_file.fclose(infile); utl_file.fclose(outfile); EXCEPTION WHEN OTHERS THEN raise_application_error(-20099, 'Unknown UTL_FILE Error'); END my_app2l; /
What I've done here is added a new Boolean variable. Loop in each iteration after reading one line, we check if the line starts with "foo". If yes then set the Boolean variable and writing out the startup file until we get a line that ends with "ZEN." That way even if there are several paragraphs in an input file starting with foo and ending with ZEN, then those should get copied to the output file.
Hope this helps,
-Gregory
-
Need help to write a script that opens files, removes layers and sous-calques
Hey all,.
I'm a noob to the community of script, and what I try to do is file edit commands that share the same names of layers and sublayers. I have a few questions that would be incredibly useful if I could have answered.
I'm not sure how to define a script too call out of the layers that have been created without script. I need to create a variable for the existing layers and leave the script to know what their names are in the files?
For example, I have three files which have each layer named 'cutlayer', 'trimlayer', 'fold' and 'work '. I need to write a script that opens three files, deletes the layer 'fold' of each file, and then move the layer "trimlayer" in his own sublayer in 'work' (the base layer can be on the top so reorganization sublayers is not necessary to worry about something). I do not understand how to write the script because I couldn't find examples in the documentation for the script provided on the adobe website which has worked with existing files.
It's my shot at what I'm trying to do, with English fill in the blanks of what I do not know how to script. If anyone can help me understand this point, I would really appreciate it!
app.documents.openDlg (prompt, filter, MultiSelect); the user opens the associated files
If (documents.length > 0) //run the script through each document individually
{
sourceDoc = activeDocument;
delete the "fold" sourceDoc layer
move the "trimlayer" in the layer "work."
remove the underlayment 'path' of layer "work."
Run the script through each document
Save the new file name folder in the new parallel to the current folder on the hard disk
Go out and spend in each document until there is no more
}
create new document
Place documents published in different layers in the new document, with a distance between them, optimize the space on a 51 "x 51" work plan, using as little of the artboard as possible. "
All comments are things basically, I do not know how and am trying to figure out how to do, so if anyone has a second to explain some of these things, I would really appreciate it!
Thanks again!
I know it of very frustrating when his apprenticeship and things don't go as planned, but understand that it is quite confusing as it is and do not add more confusion to the mix by using other tools than those provided. I mean JSLint, it might be useful with GENERAL javascript syntax, but Adobe's Javascript implementation is another animal, or another language, always JavaScript, but intended to be run by its own engine. JSLint has no idea what "layers", or "pathItems" are, it will trigger errors when he sees the objects, it does not recognize.
.. .in learning... not to take baby, write a single line of code and run... If it works, write another line of code
Try this version (always in the ESTK),'re missing you a few "++", and you do not change "documents" with "docs" in a certain place
var docs = File.openDialog("Select Files to Open", "*.ai", true); var idx = 0; for (idx = 0; idx < docs.length; ++idx) { var doc = app.open(docs[idx]); var myCounter = 0; for (myCounter = 0; myCounter < doc.layers.length; myCounter++) { doc.layers[myCounter].locked = false; } doc.layers.getByName('Crease').remove(); doc.layers.getByName('Regmark').remove(); doc.layers.getByName('Artwork').pathItems[0].remove(); doc.layers.getByName('Through Cut').hasSelectedArtwork = true; doc.layers.getByName('Through Cut').pathItems[0].strokeColor = doc.swatches.getByName("Black").color; doc.layers.getByName('Through Cut').move(doc.layers.getByName('Artwork'), ElementPlacement.INSIDE); }
Maybe you are looking for
-
PSC 2510 double prints the left margin - transport stops
Hi, my 2510 double print the left margin so as to look as if the letters are ghosts, now it started to leave a wide width of letters about an inch from the left margin. At the same time, he will start a print job only to have the transport stop about
-
Pavilion x 360: use HDD Enclosure migrate?
Hello, im new to the migration of disk, but I am upgrading my Pavilion x 360 13.3 "of the SSD HARD drive. I have a spare box external HARD drive which is SATA III 2.5 "USB 3.0, can I use it with the SSD to migrate disk instead of having to buy a SATA
-
CQ60 even on new battery no power does not turn on
Presario CQ60 Just plugged in power and no power no start. I bought a new charger and all the light no longer works, no fan and now the battery becomes hot. Any help?
-
8 GB of RAM upgrade for ES1-311-C9XM recognized as 2 GB
I bought a laptop Acer Aspire ES1-311-C9XM earlier. Only, it came with 2 GB of RAM so I decided to upgrade the RAM. After doing some research on the net, I discovered that it could be upgraded up to 8 GB of RAM. The RAM module that it was originally