Skip to content

Commit d36b050

Browse files
committed
Fix #94 - Added "Better" example in G-3310
1 parent 28b46cb commit d36b050

File tree

1 file changed

+20
-0
lines changed
  • docs/4-language-usage/3-dml-and-sql/3-transaction-control

1 file changed

+20
-0
lines changed

docs/4-language-usage/3-dml-and-sql/3-transaction-control/g-3310.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,24 @@ begin
6363
commit;
6464
end;
6565
/
66+
```
67+
68+
## Example (better)
69+
70+
(Assuming suitable foreign key relationship exists to allow updating a join.)
71+
72+
``` sql
73+
begin
74+
update (
75+
select o.customer_id, ol.discount
76+
from orders o
77+
join order_lines ol
78+
on ol.order_id = o.order_id
79+
where o.order_status = 'New'
80+
)
81+
set discount = sales_api.calculate_discount(p_customer_id => customer_id);
82+
83+
commit;
84+
end;
85+
/
6686
```

0 commit comments

Comments
 (0)