Helps the query!
Question: Program to write PLSQL to calculate electricity charge for given units and for the pending amount includes 5%.
Entry: Number of units and amount pending
output: total amount to pay.
slab:
min_units | Max_units | Rate |
---|---|---|
0 | 199 | 3 |
200 | 299 | 5 |
300 | 399 | 7 |
> 400 | 9 |
PROGRAM:
DECLARE
v_unit: = number (7): & Enter_consumed_units;
v_total_amount number (7.2);
v_pending_amount number (5): = & Enter_pending_amount;
BEGIN
v_total_amount: = BOX
WHEN v_unit < 199 THEN v_unit * 3 + v_pending_amount;
WHEN v_unit BETWEEN 200 AND 299 CAN (v_unit-199) * 199 * 5 + 3 + (v_pending_amount * 0.05);
WHEN BETWEEN 300 AND 399 v_unit THEN (v_unit-299) * 7 + (100 * 5) + 199 * 3 + (v_pending_amount * 0.05);
WHEN v_unit > 400 THEN (v_unit-399) * 9 +(100*5) + 199 * 3 +(100*7) + (v_pending_amount * 0.05);
END;
dbms_output.put_line (' Total amount to ' | v_unit |) "consumed". "is ' |" v_total_amount);
END;
/
But the above program gives me error, the following error "Bind Variable 199 not found" when I get 199 as a unit.
Hello
v_unit: = number (7): & Enter_consumed_units;
should be
v_unit number (7): = & Enter_consumed_units;
Do not write code so both. Take baby steps. Write as little as possible (in this case, maybe 3 lines), test, repair (if necessary), test again and only when as long as it works, add another 1 or 2 lines. When you get errors, you will have a better idea of exactly what caused the error. It will usually be in the bit of code added to the final stage of baby.
Furthermore, you need not PL/SQL to get these results. This looks like a school exercise, but you still haven't PL/SQL.
Tags: Database
Similar Questions
-
Helps the query in the effects control.
Hello everyone, I hope that someone can help you.
I have a little trouble trying to move images around the screen in my sequence to create an animation of a cursor moving to another location. The problem is when I put a marker in the query in the effect control to it's own journey sometimes going upward or down or left or right. I see that there are lines that are the focus of the image, as well as those of the tool pen in Photoshop and I think that that is what is causing the image of the cursor moving on its own. The two same lines by an image to make a smooth arch of movement these lines of travel to smooth the movement rather than a simple at the following location.
I was wandering because this is the case whenever I put a new marker in the motion effects controls if there is something that is originally what I can disable. I can move these lines from the central point, but that does not make the smoother actions in my sequence.
Any help is really appreciated.
You set keyframes on linear:
Adobe Premiere Pro help. Control to make changes using keyframe interpolation
-
Helps the query using summary on partition
I don't know that miss me something small here. I need to make an inventory of end.
The formula is the following:
For the 501, end = store inventory
-closing inventory 7292.19
-supplies - 30,64 closing stock
-closing inventory for buns - 1002.34
= -----------
6259.21
I can get the stock of closing with analytics, but cannot end inventory.
My dollar gap is also swollen. It should be 780.55 for store 501;
-= = So I separated it and still get incorrect resultCREATE TABLE "SUBQUERY_CATEGORIES" ( "STOREID" NUMBER NOT NULL ENABLE, "WEEK_NBR" NUMBER, "DESCRIPTION" VARCHAR2(100 BYTE) NOT NULL ENABLE, "OPEN_INVENTORY" NUMBER, "CLOSING_INVENTORY" NUMBER, "TRANSFER_IN_COST" NUMBER, "TRANSFER_OUT_COST" NUMBER, "DELV_COST" NUMBER, "PREV_DELV_COST" NUMBER, "TOTAL_COST" NUMBER, "DOLLAR_VARIANCE" NUMBER ) ; Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (501,1,'Other Foods-I',880.04,837.16,17.32,0,491.92,880.044,837.158,35124.92); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (27,1,'Shortening-I',199.7,200.32,0,0,99.85,199.7,200.324,390.45); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (25,1,'Meat-I',154.69,464.06,168.75,42.188,1406.25,154.688,464.063,1239.85); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (25,1,'Bacon-I',74.99,62.63,19.405,0,154.16,74.992,62.628,1239.85); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (501,1,'Repairs & Maint',0,0,0,0,195,0,0,780.55); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (501,1,'Supplies',25.92,30.64,0,0,139.43,25.923,30.637,37466.58); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (25,1,'Drinks-I',585.06,750.36,0,0,715.87,585.058,750.358,8678.93); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (501,1,'Chili Ingridients-I',177.99,214.47,5.918,5.918,302.88,177.995,214.466,4683.32); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (27,1,'Meat-I',540,264.38,14.063,28.125,1181.25,540,264.375,780.89); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (27,1,'Paper-I',955.71,839.86,0,15.308,600.54,955.71,839.859,19131.9); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (27,1,'Supplies',11.78,9.43,0,0,158.85,11.783,9.427,17570.11); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (27,1,'Produce-I',180.5,98.64,0,0,206,180.498,98.638,3904.47); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (25,1,'Condiments-I',170.14,153.46,8.668,0,164.86,170.14,153.456,6819.16); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (27,1,'Repairs & Maint',0,0,0,0,500,0,0,390.45); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (25,1,'Fries-I',78.22,120.33,54.15,18.05,631.75,78.217,120.333,619.92); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (501,1,'Paper-I',1113.09,1093.63,50.884,14.07,846.22,1113.089,1093.633,43711.01); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (27,1,'Cheese-I',63.78,58.7,0,0,197.07,63.783,58.704,1171.34); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (501,1,'Produce-I',201.56,304.85,0,0,554.85,201.56,304.847,7805.54); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (27,1,'Buns-I',1064.44,793.73,0,0,191.36,1064.44,793.73,780.89); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (27,1,'Bacon-I',251.95,155.9,0,0,115.62,251.95,155.902,780.89); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (25,1,'Paper-I',806.87,871.74,12.113,8.448,674.56,806.871,871.741,30376.25); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (501,1,'Chicken-I',561.16,570.93,94.457,0,1568.81,561.156,570.929,5463.88); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (25,1,'Chicken-I',285.86,534.67,73.007,35.97,1402.86,285.858,534.67,4339.46); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (27,1,'Drinks-I',1061.6,1040.97,0,0,584.59,1061.597,1040.971,5466.26); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (501,1,'Breakfast-I',437.9,376.44,0,0,272.42,437.904,376.438,12488.86); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (27,1,'Condiments-I',173.67,159.72,0,3.251,187.55,173.671,159.721,4294.92); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (25,1,'Chili Ingridients-I',93.59,149.49,2.445,0,253.85,93.594,149.489,3719.54); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (25,1,'Buns-I',873.54,914.48,0,0,441.6,873.54,914.48,1239.85); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (501,1,'Fries-I',39.11,126.35,36.1,36.1,884.45,39.108,126.35,780.55); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (25,1,'Supplies',4.71,4.71,0,0,195.53,4.713,4.713,27896.56); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (25,1,'Other Foods-I',615.63,627.42,1.701,0,374.4,615.63,627.419,26656.71); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (27,1,'Chicken-I',702.5,471.66,0,65.64,1120.39,702.502,471.664,2733.13); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (501,1,'Dairy-I',176.9,128.3,0,0,332.14,176.904,128.304,5463.88); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (27,1,'Dairy-I',171.78,85.3,0,0,109.38,171.783,85.297,2342.68); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (25,1,'Dairy-I',122.71,89.86,0,0,288.98,122.706,89.856,3719.54); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (25,1,'Cheese-I',140.03,109.46,0,0,131.38,140.028,109.461,1859.77); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (25,1,'Produce-I',151.15,169.85,0,3.44,270.85,151.148,169.852,6199.23); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (501,1,'Shortening-I',249.63,259.61,0,0,259.61,249.625,259.61,780.55); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (501,1,'Bacon-I',116.58,115.62,0,0,308.32,116.581,115.62,1561.11); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (25,1,'Repairs & Maint',0,0,0,0,200,0,0,619.92); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (501,1,'Cheese-I',130.9,174.52,0,0,328.45,130.897,174.516,2341.66); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (501,1,'Condiments-I',225.65,207.39,0,0,247.81,225.645,207.394,8586.09); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (27,1,'Chili Ingridients-I',159.45,109.79,5.918,0,159.6,159.45,109.788,2342.68); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (501,1,'Meat-I',752.34,696.09,0,28.125,1800,752.344,696.094,1561.11); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (501,1,'Buns-I',1090.2,1002.34,0,0,524.4,1090.2,1002.34,1561.11); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (27,1,'Fries-I',147.41,88.75,0,0,595.65,147.408,88.746,390.45); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (27,1,'Other Foods-I',658.37,645.92,0,1.701,373.34,658.375,645.925,16789.22); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (501,1,'Drinks-I',1290.03,1153.85,0,0,689.84,1290.032,1153.848,12488.86); Insert into SUBQUERY_CATEGORIES (STOREID,WEEK_NBR,DESCRIPTION,OPEN_INVENTORY,CLOSING_INVENTORY,TRANSFER_IN_COST,TRANSFER_OUT_COST,DELV_COST,PREV_DELV_COST,TOTAL_COST,DOLLAR_VARIANCE) values (25,1,'Shortening-I',159.76,179.73,0,0,199.7,159.76,179.73,619.92); SET DEFINE OFF with categorycosts as ( SELECT storeid , week_nbr , UPPER(TRIM(description)) description , NVL(prev_delv_cost + transfer_in_cost + delv_cost - transfer_out_cost - total_cost, 0) AS cost , open_inventory , dollar_variance , sum(closing_inventory ) over (partition by storeid, week_nbr ) closing_inventory -- , closing_inventory from subquery_categories where storeid = 501 ) , pivoted_cat_costs AS (SELECT storeid , week_nbr , MAX(DECODE(closing_inventory, 0, 0, closing_inventory)) - NVL(MAX(DECODE(UPPER(TRIM(description)), 'SUPPLIES', cost)), 0) - NVL(MAX(DECODE(UPPER(TRIM(description)), 'BUNS-I', cost)), 0) as closing_inventory , MAX(DECODE(dollar_variance, 0, 0, dollar_variance)) as dollar_variance , NVL(MAX(DECODE(UPPER(TRIM(description)), 'SUPPLIES', cost)), 0) supplies , NVL(MAX(DECODE(UPPER(TRIM(description)), 'REPAIRS & MAINT', cost)), 0) repairs_and_maint , NVL(MAX(DECODE(UPPER(TRIM(description)), 'BUNS-I', cost)), 0) as buns FROM categorycosts GROUP BY storeid, week_nbr ) select * from pivoted_cat_costs;
The results should be:SELECT storeid , week_nbr , UPPER(TRIM(description)) description , NVL(prev_delv_cost + transfer_in_cost + delv_cost - transfer_out_cost - total_cost, 0) AS cost , open_inventory , dollar_variance -- , sum(closing_inventory ) over (partition by storeid, week_nbr ) closing_inventory , closing_inventory from subquery_categories;
There is an anomaly out Bill so it can produce the vairiance of good quality, but inv variance that my request is back is swollen.store 501 ending inventory = 6259.21 buns s/b 1002.34 inv variance 780.55 Store 27 ending inventory = 4220 buns s/b = 793.73 inv variance 390.45 Store 25 ending inventory = 4283 buns 914.48 inv variance 619.92
Can someone tell me what I am doing wrong?
Published by: TheHTMLDJ on December 9, 2009 06:42
SET DEFINE OFF has added and removed the subquery_categories schema nameWell, I asked for the logic as the specification and not necessarily a query. :)
Here's the query that gets your inventory of desired end.with categorycosts as ( SELECT storeid , week_nbr , UPPER(TRIM(description)) description , NVL(prev_delv_cost + transfer_in_cost + delv_cost - transfer_out_cost - total_cost, 0) AS cost , open_inventory , dollar_variance , sum(closing_inventory ) over (partition by storeid, week_nbr ) closing_inventory , DECODE(UPPER(TRIM(description)), 'SUPPLIES', closing_inventory) supp_cls_inv , DECODE(UPPER(TRIM(description)), 'BUNS-I', closing_inventory) bun_cls_inv from subquery_categories where storeid = 501 ) , pivoted_cat_costs AS (SELECT storeid , week_nbr , MAX(DECODE(closing_inventory, 0, 0, closing_inventory)) - NVL(MAX(supp_cls_inv), 0) - NVL(MAX(bun_cls_inv), 0) as closing_inventory , MAX(DECODE(dollar_variance, 0, 0, dollar_variance)) as dollar_variance , NVL(MAX(DECODE(UPPER(TRIM(description)), 'SUPPLIES', cost)), 0) supplies , NVL(MAX(DECODE(UPPER(TRIM(description)), 'REPAIRS & MAINT', cost)), 0) repairs_and_maint , NVL(MAX(DECODE(UPPER(TRIM(description)), 'BUNS-I', cost)), 0) as buns FROM categorycosts GROUP BY storeid, week_nbr ) select * from pivoted_cat_costs;
I still don't know the logic (or specifications) to derive your dollor expected variance.
-
HII Guru
Please help me.
I have question
Select
HP.party_name as a customer,
RCT.trx_number like Bill,
RCT.trx_date,
rctl.attribute3 as Faktur_Pajak,
rctl.attribute4 as TIN,
rctl.line_number not,.
rctl. Description,
GCC. Segment1 |'. ' | GCC. Segment2 |'. ' | GCC.segment3 |'. ' | GCC.segment4 |'. ' | GCC.segment5 |'. ' | GCC.segment6 as COA,
rctl.extended_amount as long as dpp,.
rctl.extended_amount * avt.tax_rate / 100 / rctl.extended_amount * 100 as tax_rate,.
rctl.extended_amount * avt.tax_rate / 100 as NPP
Of
ra_customer_trx_lines_all rctl,
ra_customer_trx_all rct,
hz_cust_accounts AOB,
hz_parties hp,
ar_vat_tax_all_b avt,
gl_code_combinations gcc,
ar_memo_lines_all_b amb
where 1 = 1
and rct.org_id = "122"
and rct.trx_number = 'ExpressMay14.13143. '
and rctl.memo_line_id = amb.memo_line_id
and amb.gl_id_rev = gcc.code_combination_id
and hca.party_id = hp.party_id
and rct.customer_trx_id = rctl.customer_trx_id
and rct.sold_to_customer_id = hca.cust_account_id
and avt.vat_tax_id = rctl.vat_tax_id
and rctl.description is not null
and rct.trx_date BETWEEN TO_DATE('05/01/2014','MM/DD/YYYY') AND TO_DATE('05/07/2014','MM/DD/YYYY')
order of trx_date
and the result is
CUSTOMER INVOICE TRX_DATE FAKTUR_PAJAK TIN NO. DESCRIPTION COA GP3 TAX_RATE NPP EVAGENITA, UD ExpressMay14.13143 2 May 14 040.001 - 14.81637149 07.358.521.8 - 311,000 1 BKS-Express 21.W10.544300.0000.000.000 2 664 750 1 26 648 EVAGENITA, UD ExpressMay14.13143 2 May 14 040.001 - 14.81637149 07.358.521.8 - 311,000 2 Stamp duty 21.000.807220.0000.000.000 6 000 0 0 actually I want to display as
CUSTOMER INVOICE TRX_DATE FAKTUR_PAJAK TIN NO. DESCRIPTION COA GP3 TAX_RATE NPP Total EVAGENITA, UD ExpressMay14.13143 2 May 14 040.001 - 14.81637149 07.358.521.8 - 311,000 1 BKS-Express 21.W10.544300.0000.000.000 2 664 750 1 26 648 2 Stamp duty 21.000.807220.0000.000.000 6 000 0 0 2 697 398 Consider the with t as ( ... ) As your actual query. You can do this. SQL> with t 2 as 3 ( 4 select 'EVAGENITA, UD' customer 5 , 'ExpressMay14.13143' invoice 6 , to_date('2-May-14','dd-mon-rr') trx_date 7 , '040.001-14.81637149' faktur_pajak 8 , '07.358.521.8-311.000' npwp 9 , 1 no 10 , 'BKS-Express' description 11 , '21.W10.544300.0000.000.000' coa 12 , 2664750 dpp 13 , 1 tax_rate 14 , 26648 pnn 15 from dual 16 union all 17 select 'EVAGENITA, UD' customer 18 , 'ExpressMay14.13143' invoice 19 , to_date('2-May-14','dd-mon-rr') trx_date 20 , '040.001-14.81637149' faktur_pajak 21 , '07.358.521.8-311.000' npwp 22 , 2 no 23 , 'Stamp Duty' description 24 , '21.000.807220.0000.000.000' coa 25 , 6000 dpp 26 , 0 tax_rate 27 , 0 pnn 28 from dual 29 ) 30 select decode(rno, 1, customer) customer 31 , decode(rno, 1, invoice) invoice 32 , decode(rno, 1, trx_date) trx_date 33 , decode(rno, 1, faktur_pajak) faktur_pajak 34 , decode(rno, 1, npwp) npwp 35 , no 36 , description 37 , coa 38 , dpp 39 , tax_rate 40 , pnn 41 , case when 42 rno = cnt then 43 sum 44 ( 45 dpp+pnn 46 ) 47 over 48 ( 49 partition 50 by customer 51 , invoice 52 , trx_date 53 , faktur_pajak 54 , npwp 55 order 56 by no 57 ) 58 end total 59 from ( 60 select t.* 61 , row_number() over 62 ( 63 partition 64 by customer 65 , invoice 66 , trx_date 67 , faktur_pajak 68 , npwp 69 order 70 by no 71 ) rno 72 , count(*) over 73 ( 74 partition 75 by customer 76 , invoice 77 , trx_date 78 , faktur_pajak 79 , npwp 80 ) cnt 81 from t 82 ); CUSTOMER INVOICE TRX_DATE FAKTUR_PAJAK NPWP NO DESCRIPTION COA DPP TAX_RATE PNN TOTAL ------------- ------------------ --------- ------------------- -------------------- ---------- ----------- -------------------------- ---------- ---------- ---------- ---------- EVAGENITA, UD ExpressMay14.13143 02-MAY-14 040.001-14.81637149 07.358.521.8-311.000 1 BKS-Express 21.W10.544300.0000.000.000 2664750 1 26648 2 Stamp Duty 21.000.807220.0000.000.000 6000 0 0 2697398 SQL>
-
Hello Experts
I can't in select the record_sequence in the output. Please see the part of the desired effect.
Please help solve this problem.
Is the version of Oracle, I'm working on that
Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production
With partitioning, OLAP, Data Mining and Real Application Testing options
Thank you
RB
TABLE1 AS
(
SELECT '28' EXAM_CD1, EXAM_CD2 '29', '10' EXAM_CD3, 111' CAND_ID FROM DUAL UNION ALL
SELECT '21' EXAM_CD1, EXAM_CD2 '39', '20' EXAM_CD3, 112' CAND_ID FROM DUAL UNION ALL
SELECT '22' EXAM_CD1, EXAM_CD2 '49', '30' EXAM_CD3, 113' CAND_ID FROM DUAL UNION ALL
SELECT 'EXAM_CD1 23', '59' EXAM_CD2, EXAM_CD3 ' 40', 114' CAND_ID FROM DUAL UNION ALL
SELECT '24' EXAM_CD1, EXAM_CD2 '69', '50' EXAM_CD3, 115' DOUBLE CAND_ID)
AS TABLE2
(
SELECT EXAM_CD '28', '111' CANDID, 1 RECORD_SEQ OF DOUBLE UNION ALL
SELECT '30' EXAM_CD, '113' CANDID, 2 RECORD_SEQ FROM DUAL UNION ALL
SELECT EXAM_CD '94', '111' CANDID, 3 RECORD_SEQ OF DOUBLE UNION ALL
SELECT EXAM_CD '69', '115' CANDID, 4 DOUBLE RECORD_SEQ)
(
SELECT EXAM_CD FROM TABLE2, CANDID
LESS
SELECT CAND_ID,
MAX (L CASE WHEN 1 EXAM_CD1 THEN WHEN 2 THEN of OTHER EXAM_CD2 EXAM_CD3 END) exam_code
FROM TABLE1,
(SELECT LEVEL L FROM DUAL CONNECT BY LEVEL < = 3)
CAND_ID GROUP, L)
The aim is
CAND_ID, EXAM_CD, RECORD_SEQ
* 111, 94, 3 *.Hello
Rb2000rb65 wrote:
The solution use not less as long as I get my results using the latest features, it is good with me.Good idea!
UNMIS is not the best tool for this task. The saved query gets the exam_cd and the Candide you want, but you can't find the record_seq because there of nothing like record_seq in table1.You can do this way:
SELECT * FROM table2 m WHERE NOT EXISTS ( SELECT 1 FROM table1 WHERE m.candid = candid AND m.exam_cd IN ( exam_cd1 , exam_cd2 , exam_cd3 ) ) ;
I guess you could use LESS, like this
SELECT * FROM table2 WHERE (exam_cd, candid) IN ( SELECT ... -- The MINUS query you posted goes here ) ;
but it is unecessarily complicated.
-
Helps the query using case and County
Hello!
I have problems with a small part of a query below that finally can settle the invoice price.
(count (distinct spm97.sample_id) * 36.1) as "PROFILE."
case count (distinct spm33.sample_id)
When (count (distinct spm97.sample_id) = 0) then (count (distinct spm33.sample_id) * 26)
another (count (distinct spm33.sample_id) * 4.75)
put an end to 'CC ',.
The first line works - 0 or 36.10 is returned depending on whether or not a profile has been ordered for the sample.
The cost of CC is 4.75 if a profile was also sentenced, if it isn't then the cost is 26. The case statement is supposed to verify this and return the exact amount, but I can't make it work... I get the error message that a closing parenthesis is missing somewhere in the middle of line 3, if that helps.
Any advice would be much appreciated! Of course, this isn't the entire query - joins and all are all working well, it's just this little section with the County that I can't just.
Thank you
JOthe piece of code below, seems to me is incorrect
CASE COUNT(DISTINCT spm33.sample_id) WHEN ( COUNT(DISTINCT spm97.sample_id) = 0 ) THEN (COUNT(DISTINCT spm33.sample_id) * 26) ELSE (COUNT(DISTINCT spm33.sample_id) * 4.75) END AS "CC"
It seems that the requirement here is that if * 'COUNT (DISTINCT spm97.sample_id) = 0' *, then * "CC" * should be ' COUNT (DISTINCT spm33.sample_id) (* 26) "ELSE, it should be" COUNT (DISTINCT spm33.sample_id) (* 4.75)»
If this is the case, the statement must include:CASE COUNT(DISTINCT spm97.sample_id) WHEN 0 THEN (COUNT(DISTINCT spm33.sample_id) * 26) ELSE (COUNT(DISTINCT spm33.sample_id) * 4.75) END AS "CC"
-
Join itself find missing links, helps the query, table
Data in the table:
I'm trying to right a query that returns the relationships that are the only way.tblRelationships RelationshipID SourceID DestinationID 1 100 200 2 200 100 3 300 100
So for the above data, 3 would return because he'll only source 300 to 100 and not source from 100 to 300.
Published by: avalanche333 on January 15, 2010 12:26SQL> create table tblRelationships ( 2 RelationshipID NUMBER, 3 SourceID NUMBER, 4 DestinationID NUMBER) 5 / Table created. SQL> insert into tblRelationships values (1,100,200); 1 row created. SQL> insert into tblRelationships values (2,200,100); 1 row created. SQL> insert into tblRelationships values (3,300,100); 1 row created. SQL> SQL> select relationshipid from tblrelationships 2 where sourceid in ( 3 select SourceID from tblRelationships 4 minus 5 select destinationid from tblRelationships) 6 / RELATIONSHIPID -------------- 3 SQL> drop table tblRelationships 2 / Table dropped. SQL>
-
-Create/insert example:
create table xxdummy)
integer ID,
name varchar2 (40),
Description varchar2 (100)
);
insert into xxdummy values (1, 'L', ' press L Simple');
insert into xxdummy values (2, 'XL', "XL with no film");
insert into xxdummy values (2, 'web', "XL with no film");
insert into xxdummy values (3, 'XL', 'XL with the Film');
insert into xxdummy values (3, 'Film', 'XL with the Film');
insert into xxdummy values (3, 'print', 'XL with the Film');
insert into xxdummy values (4, the of ', 'servo with the film');
insert into xxdummy values (4, 'Film', 'servo with the film');
insert into xxdummy values (5, the servo only ',' ');
insert into xxdummy values (6, 'L', 'Press L Simple');
insert into xxdummy values (7, 'XL', "XL with no film");
insert into xxdummy values (8, 'XL', 'XL with the Film');
insert into xxdummy values (8, 'Film', 'XL with the Film');
insert into xxdummy values (8, 'guide', 'XL with the Film');
-drop table xxdummy;
Select * from xxdummy;
SELECT id, description, decode type ("name, ' the, 'L only', 'XL', ' Got XLs here","no opinion")
of xxdummy
WHERE name in ('l', 'XL')
In above query for the type of column, I want to display 'Only L', "XL with Film", "XL without Film.
How can I do this?
Thank youHello
You can change the Andreas solution' to show the name instead of the description and some minor changes in the wording of the type.
You can also rearrange the expression BOX so that you do not need a nested case.select id, name, CASE WHEN name = 'L' THEN ' L Only' WHEN name != 'XL' THEN 'dont know' WHEN INSTR (description, 'with no') >0 THEN 'XL No Film' ELSE 'XL Film' END type from xxdummy where name in ('L','XL' ) ;
-
Help the query to list all the days between MIN and MAX date in a table
Hello
Sorry, this may have already responded earlier, but I really struggled to find a previous response with the new provision of the RTO.
In a DB 11 g, I date MIN and MAX in a table:
{code}
SELECT MIN (process_date) start_date, MAX (process_date) end_date FROM my_table;
{code}
I would get every day between these 2 dates. I mean even is there is no record in the table for a date.
Is this possible?
Thanks in advance,
Olivier
Hello
Do you mean something like this?
ranit@XE11GR2>> ed Wrote file c:\rb\1.sql 1 with xx as 2 ( 3 select 4 to_date('05-06-2013','dd-mm-yyyy') min_d, 5 to_date('20-06-2013','dd-mm-yyyy') max_d 6 from dual 7 ) 8 -- 9 -- end of test data 10 -- 11 select 12 min_d + level date_x 13 from xx 14* connect by level<=(max_d-min_d) ranit@XE11GR2>> / DATE_X ------------------- 06-06-2013 00:00:00 07-06-2013 00:00:00 08-06-2013 00:00:00 09-06-2013 00:00:00 10-06-2013 00:00:00 11-06-2013 00:00:00 12-06-2013 00:00:00 13-06-2013 00:00:00 14-06-2013 00:00:00 15-06-2013 00:00:00 16-06-2013 00:00:00 17-06-2013 00:00:00 18-06-2013 00:00:00 19-06-2013 00:00:00 20-06-2013 00:00:00 15 rows selected.
-
Hi all
I have a table as shown below:
NO NAME SAL
---------- ---------- ----------
1 x 200
1 to 100
2 y 400
2 b 300
I want to ask in such a way that the result should be as follows:
NO NAME SAL
---------- ---------- ----------
1
x 200
a 100
2
y 400
b 300
How to write this... Thanks iin advance...
-
Hello
Could someone please help how to tune the query as its takes a long time to retrieve the results.
Select
col1,
col2,
col3,
COL4,
col5,
col6,
col7,
COL8,
col9,
col10,
Col11,
col12,
Sum (volume1),
Sum (volume2),
Sum (volume3),
Sum (volume4),
Sum (volume5),
Sum (volume6),
Sum (volume7),
Sum (volume8),
Sum (volume9),
Sum (volume10),
Sum (volume11),
Sum (volume12),
Sum (volume13),
Sum (volume14),
Sum (volume15),
Sum (volume16),
Sum (volume17),
Sum (Volume18),
Sum (volume19),
Sum (volume20),
Sum (rate1),
Sum (rate2),
Sum (rate3),
Sum (rate4),
Sum (rate5),
Sum (rate6),
Sum (rate7),
Sum (rate8),
Sum (rate9),
Sum (rate10),
Sum (rate11),
Sum (rate12),
Sum (rate13),
Sum (rate14),
Sum (rate15),
Sum (rate16),
Sum (rate17),
Sum (rate18)
Sum (rate19),
Sum (rate20)
Of
Table 1 - 13, 25, 99, 400 records
Table2 - 13, 45, 1000 records
Table 3 - 4, 50, 000 records
Table 4 - 1,00,000 records
table5 - 30 000 records
where tabl1.col1 = table2.col2,
Table1.Col1 = table3.col1.
table2.col2 = table3.col2...
Group
Sum (volume1),
Sum (volume2),
Sum (volume3),
Sum (volume4),
Sum (volume5),
Sum (volume6),
Sum (volume7),
Sum (volume8),
Sum (volume9),
Sum (volume10),
Sum (volume11),
Sum (volume12),
Sum (volume13),
Sum (volume14),
Sum (volume15),
Sum (volume16),
Sum (volume17),
Sum (Volume18),
Sum (volume19),
Sum (volume20),
Sum (rate1),
Sum (rate2),
Sum (rate3),
Sum (rate4),
Sum (rate5),
Sum (rate6),
Sum (rate7),
Sum (rate8),
Sum (rate9),
Sum (rate10),
Sum (rate11),
Sum (rate12),
Sum (rate13),
Sum (rate14),
Sum (rate15),
Sum (rate16),
Sum (rate17),
Sum (rate18)
Sum (rate19),
Sum (rate20)
Thank you
Prasad.
> Could someone please help how to tune the query as its takes a long time to retrieve the results.
The query you posted is obviously fake.
If you ask to give us a request that you do not post and we cannot see.
For real?
-
Need help to understand the query result
Hi gurus
I was reading one of the question here in this forum and its link is below:
I had some confusion related to this code and don't understand the logic of the out put, see query below:
Query
with sub_services as
(
Select su_seq 12323, 'HLR1' so_id, 1 seq Union double all the
Select su_seq 12323, "HLR2' so_id, seq 2 Union double all the
Select su_seq 12323, "A09" so_id, seq 3 of all the double union
Select su_seq 12333, "MO1" so_id, seq 4 Union double all the
Select su_seq 12333, "MO2' so_id, seq 5 Union double all the
Select su_seq 12333, "A09" so_id, 6 seq in union double all the
Select su_seq 12333, 'M0CR' so_id, seq 7 Union double all the
Select su_seq 12999, "LOL1' so_id, seq 8 Union double all the
Select su_seq 12999, "LOL2' so_id, seq 9 double
)
Select *.
of sub_services b
where exists (select 1 from sub_services
where su_seq = b.su_seq
and so_id = 'A09.
)
order by 2;
The query result
12323 A09 3
12333 6 A09
12323 HLR1 1
12323 HLR2 2
12333 M0CR 7
12333 4 MO1
12333 5 MO2
According to my understanding, the above query should return records in red only because of her is below command
It exists (select 1 from sub_services
where su_seq = b.su_seq
and so_id = 'A09.
but don't know why he's back 7 files, can someone help me understand the result...
It is query is functionally identical to the PL/SQL block, but much more effective.
declare
number of l_res;
Start
for line (select *)
sub_services) loop
Start
Select 1 from l_res
of sub_services
where su_seq = row.su_seq and
so_id = "A09" and
rownum = 1;
Essentially every row in the outer query are tested against him exists query. Given the correlation between two requests is based only on su_seq each line with a su_seq value returned by him is returned in the output.
Another way to think he uses instead a join condition. This query is equivalent to the query to exist
Select the main
of main sub_services
Join select (separate su_seq
of sub_services
where so_id = "A09") cond
We main.su_seq = cond.su_seq;
John
-
Accounting amounts with the help of query description
Hello!
I'm stuck with a query.
I have a request to the list on the General Ledger:
SELECT SOB.NAME
, GB. PERIOD_NAME
GCC. SEGMENT2
GCC. SEGMENT3
GCC. SEGMENT4
GCC. SEGMENT5
(CASE WHEN SUM (NVL (GB. PERIOD_NET_DR, 0)-NVL (GB. PERIOD_NET_CR, 0)) > = 0
THEN (SUM (NVL (GB. PERIOD_NET_DR, 0)-NVL (GB. PERIOD_NET_CR, 0)))
ELSE 0 END) "DB".
(CASE WHEN SUM (NVL (GB. PERIOD_NET_DR, 0)-NVL (GB. PERIOD_NET_CR, 0)) < = 0
THEN (SUM (NVL (GB. PERIOD_NET_DR, 0)-NVL (GB. PERIOD_NET_CR, 0)) * - 1).
ELSE 0 END) "CR."
OF GL_BALANCES GB
GCC, OB GL_SETS_OF_BOOKS GL_CODE_COMBINATIONS
WHERE CCG. CODE_COMBINATION_ID = GB. CODE_COMBINATION_ID
AND GO. ACTUAL_FLAG = "A".
/ * For the objective test to run faster towards the bottom of the query * /.
- AND GO. PERIOD_NAME = "SZE-14'.
AND GO. CURRENCY_CODE = OB. CURRENCY_CODE
AND GO. CATEGORY A NULL VALUE
AND GO. SET_OF_BOOKS_ID = OB. SET_OF_BOOKS_ID
SOB.NAME GROUP
, GB. ACTUAL_FLAG
, GB. PERIOD_NAME
GCC. SEGMENT2
GCC. SEGMENT3
GCC. SEGMENT4
GCC. SEGMENT5
NVL (GB. PERIOD_NET_DR, 0)
NVL (GB. PERIOD_NET_CR, 0)
SEEN THE SUM (NVL (GB. PERIOD_NET_DR, 0)-NVL (GB. PERIOD_NET_CR, 0)) <>0
ORDER BY 1,2,3,4,5,6,7,8,9
This query works very well and the accountant confirmed that it is to show the right quantities. I want to add the description for the book numbers I've already discovered that the desription is stored in applications. Table FND_FLEX_VALUES_VL. I also discovered that the connection can be established with applications. FND_FLEX_VALUES_VL. FLEX_VALUE and GL_CODE_COMBINATIONS. SEGMENT2 so I changed my query like this:
SELECT SOB.NAME
, GB. PERIOD_NAME
GCC. SEGMENT2
GCC. SEGMENT3
GCC. SEGMENT4
GCC. SEGMENT5
FVV. DESCRIPTION
(CASE WHEN SUM (NVL (GB. PERIOD_NET_DR, 0)-NVL (GB. PERIOD_NET_CR, 0)) > = 0
THEN (SUM (NVL (GB. PERIOD_NET_DR, 0)-NVL (GB. PERIOD_NET_CR, 0)))
ELSE 0 END) "CR."
(CASE WHEN SUM (NVL (GB. PERIOD_NET_DR, 0)-NVL (GB. PERIOD_NET_CR, 0)) < = 0
THEN (SUM (NVL (GB. PERIOD_NET_DR, 0)-NVL (GB. PERIOD_NET_CR, 0)) * - 1).
ELSE 0 END) "DB".
OF GL_BALANCES GB
GCC GL_CODE_COMBINATIONS LEFT JOIN EXTERNAL APPS. FND_FLEX_VALUES_VL FVV ON GCC. = FVV.flex_value, GL_SETS_OF_BOOKS OB SEGMENT2
WHERE CCG. CODE_COMBINATION_ID = GB. CODE_COMBINATION_ID
AND GO. ACTUAL_FLAG = "A".
AND FVV.description is not null
/ * For testing purpose flow down the query faster please comment the following line to the environment of the product * /.
- AND GO. PERIOD_NAME = "SZE-14'.
AND GO. CURRENCY_CODE = OB. CURRENCY_CODE
AND GO. CATEGORY A NULL VALUE
AND GO. SET_OF_BOOKS_ID = OB. SET_OF_BOOKS_ID
SOB.NAME GROUP
, GB. ACTUAL_FLAG
, GB. PERIOD_NAME
GCC. SEGMENT2
GCC. SEGMENT3
GCC. SEGMENT4
GCC. SEGMENT5
FVV. DESCRIPTION
NVL (GB. PERIOD_NET_DR, 0)
NVL (GB. PERIOD_NET_CR, 0)
SEEN THE SUM (NVL (GB. PERIOD_NET_DR, 0)-NVL (GB. PERIOD_NET_CR, 0)) <>0
ORDER BY 1,2,3,4,5,6,7,8,9
Which duplicates some lines, if I comment out 'AND FVV.description is not null' this line I see a few lines where the description is null. I think that I am so close to the result, but I'm stuck
Thanks in advance for your help.
Zsolt
Hello!
I managed to make it work. If anyone else here is the query to work.
SELECT SOB.NAME 'name '.
, GB. PERIOD_NAME 'period Code.
GCC. SEGMENT2 'account number '.
GCC. SEGMENT3
GCC. SEGMENT4
GCC. SEGMENT5
, T.nev "name of the book.
(CASE WHEN SUM (NVL (GB. PERIOD_NET_DR, 0)-NVL (GB. PERIOD_NET_CR, 0)) > = 0
THEN (SUM (NVL (GB. PERIOD_NET_DR, 0)-NVL (GB. PERIOD_NET_CR, 0)))
ELSE 0 END) 'throughput '.
(CASE WHEN SUM (NVL (GB. PERIOD_NET_DR, 0)-NVL (GB. PERIOD_NET_CR, 0))<=>=>
THEN (SUM (NVL (GB. PERIOD_NET_DR, 0)-NVL (GB. PERIOD_NET_CR, 0)) * - 1).
ELSE 0 END) 'Crédit'
OF GL_BALANCES GB
GCC, OB GL_SETS_OF_BOOKS GL_CODE_COMBINATIONS
(select flex_value szam, nev description
from APPS. FND_FLEX_VALUES_VL
where flex_value_set_id = '1003463'
) T
WHERE CCG. CODE_COMBINATION_ID = GB. CODE_COMBINATION_ID
AND GO. ACTUAL_FLAG = "A".
/ * For testing purpose speeds up query execution
- AND GO. PERIOD_NAME = "SZE-14'.
*/
AND T.szam = Gcc.segment2
AND GO. CURRENCY_CODE = OB. CURRENCY_CODE
AND GO. CATEGORY A NULL VALUE
AND GO. SET_OF_BOOKS_ID = OB. SET_OF_BOOKS_ID
SOB.NAME GROUP
, GB. ACTUAL_FLAG
, GB. PERIOD_NAME
GCC. SEGMENT2
GCC. SEGMENT3
GCC. SEGMENT4
GCC. SEGMENT5
NVL (GB. PERIOD_NET_DR, 0)
NVL (GB. PERIOD_NET_CR, 0)
T.Nev
/ * Uncomment to show only values that are not null
-HAVE SUM (NVL (GB. PERIOD_NET_DR, 0)-NVL (GB. PERIOD_NET_CR, 0)) <> 0
*/
ORDER BY 1,2,3,4,5,6,7,8,9
-
I have the data into two table with the structure of similar column, I want to loop through the data in these two tables
based on some condition and runtime that I want to put the query in loop for example, the example is given, please help me
create table ab (a number, b varchar2 (20));
Insert into ab
Select rownum, rownum. "" sample "
of the double
connect by level < = 10
create table bc (a number, b varchar2 (20));
Insert into BC.
Select rownum + 1, rownum + 1 | "" sample "
of the double
connect by level < = 10
declare
l_statement varchar2 (2000);
Boolean bool;
Start
bool: = true;
If it is true, then
l_statement: =' select * ab ';
on the other
l_statement: =' select * from bc';
end if
I'm in execute immediate l_statement - something like that, but I don't know
loop
dbms_output.put_line (i.a);
end loop;
end;
Something like that, but this isn't a peace of the code work.
Try this and adapt according to your needs:
declare
l_statement varchar2 (2000);
c SYS_REFCURSOR;
l_a number;
l_b varchar2 (20);
Boolean bool;
Start
bool: = true;
If it is true, then
l_statement: = "select a, b, AB;
on the other
l_statement: = "select a, b from bc;
end if;
--
Open c for l_statement;
--
loop
extract the c in l_a, l_b;
When the output c % notfound;
dbms_output.put_line (l_a |') -' || l_b);
end loop;
close c;
end;
/
-
Hi, can someone help me with the query. I try to display comm based on calculation below
SAL < 5000 then 10%
5000 - 10000 then 15%
> 10000 then 20%
This is the query
DECLARE
v_comm number (7.2);
v_Name emp.ename%type;
v_empno emp.empno%type;
v_sal emp.sal%type;
BEGIN
SELECT ename, empno, sal IN
v_Name, v_empno, v_sal
EMP;
v_comm: = (IF v_sal < v_sal*.10 then 5000;)
ELSIF v_sal between 5001 AND 10000 THEN v_sal*.15;
Of ANOTHER v_sal > 10001 THEN v_sal*.20;
END IF ;);
dbms_output.put_line(v_Name||) e with empno' | v_empno | "win a comm' | v_comm);
END; /
also tried
DECLARE
v_comm number (7.2);
v_Name emp.ename%type;
v_empno emp.empno%type;
v_sal emp.sal%type;
BEGIN
SELECT ename, empno, sal IN
v_Name, v_empno, v_sal
EMP;
IF v_sal < v_comm then 5000: = v_sal*.10;
ELSIF v_sal between 5001 AND 10000 THEN v_comm: = v_sal*.15;
Of ANOTHER v_sal > 10001 THEN v_comm: = v_sal*.20;
END IF ;);
dbms_output.put_line(v_Name||) e with empno' | v_empno | "win a comm' | v_comm);
END;
/
Hello
Look at the syntax of the IF in the PL/SQL manual. Comapre to the instruction BOX and also the expression BOX.
Perhaps, instead of an IF statement
v_comm: = (IF v_sal<5000 then="">5000>
ELSIF v_sal between 5001 AND 10000 THEN v_sal*.15;
ELSE v_sal > 10001 THEN v_sal*.20;
END IF ;);
you wanted to write an expression BOX, like this:
v_comm: = BOX
WHEN v_sal< 5000 ="" then="" v_sal="" *="">
WHEN v_sal BETWEEN 5001 AND 10000 THEN v_sal *.15
WHEN v_sal > 10001 THEN v_sal *.20
END;
Or perhaps cela:
v_comm: = v_sal * CASE
WHEN v_sal<= 5000="" then="">= >
WHEN v_sal<= 10000="" then="">=>
OF AUTRE.20
END;
You can also use a CASE expression in the SELECT statement.
Maybe you are looking for
-
I bought MS Office with Outlook for Mac 2016. Outlook is so slow and takes forever to load a message or to move from one to the other. It maintains give up connection too and it makes me crazy. He sends empty messages, even if the message is not
-
Open an image without downloading
HelloOften when I left click on a hyperlink to an image, Firefox will ask me where I would like to download. However, my goal of clicking this link should just open the image in a new tab. When I went to find the default option for opening a picture,
-
Re: Satellite L650 and 'Final Version' software
Dear people of Toshiba, I'm a happy user of the Satellite L65. However, I have an unusual problem. First of all, I am Croatian, and my keyboard Adriatic region has specific Slavic letters such as "?,?," etc. (maybe they are not displayed directly on
-
My iPod syncs to all the auto or manual.
My Ipod syncs to all the auto or manual. no problem until now. work and recognise to play, but do not reconise legacy Ipod for synchronization before automatic just when must plug usb pluged in now go into windows mediea player hit the Sync tab and
-
Want to 700-430qe: installation of the establishment by car hides after the
I installed a 64 GB mSata drive to use as a cache drive, and while the drive looks very good I not give me the opportunity to set up as a cache drive. I have installed Intel Rapid Storage Tech software and the drive also appears in this software very