PL/SQL - one procedure for business logic


 
Thread Tools Search this Thread
Top Forums Programming PL/SQL - one procedure for business logic
# 1  
Old 01-20-2013
PL/SQL - one procedure for business logic

Hello, I need some advice how to to create one big transactional table.

My table has following columns

person_id, trans_id, date, dep_id, material_id, input, outpu, total

I created procedure from which I will enter all transaction into that table. Problem is I don't have any idea how to achive following.

When I enter for example id for paper and input size of 0,5, everything I see is the same counter which is updated for each transaction no matter which material is being updated.

So I need some ideas abou following

1. How to keep old data in record no matter how many times
I enter some data ?
2. How to reduce number of input arguments, now I need to specify all values (output_size and total := 0) so I can calculate changes.
3. How can I add more rigid checks in if statement for example
(if total_size > 0 && output_size == 0) ?

I need something like SAP enviroment Smilie
# 2  
Old 01-20-2013
1. How to keep old data in record no matter how many times I enter some data ?
I did not understand this question!

2. How to reduce number of input arguments, now I need to specify all values (output_size and total := 0) so I can calculate changes.
PLSQL does support default parameter values.
Code:
PROCEDURE proc_name (total IN NUMBER DEFAULT 5) IS ...
OR
PROCEDURE proc_name (total IN NUMBER := 5) IS ...

So you can ignore total from actual parameter list when calling this procedure.

3. How can I add more rigid checks in if statement for example (if total_size > 0 && output_size == 0) ?
PLSQL does support AND and OR
Code:
IF total_size > 0 AND output_size = 0 THEN
statments
ENF IF;

# 3  
Old 01-21-2013
Quote:
Originally Posted by bipinajith
1. How to keep old data in record no matter how many times I enter some data ?
I did not understand this question!
Ok, as I said this how many columns my "big table" has

Code:
person_id, trans_id,  date, dep_id, material_id, input, outpu, total

if I enter

100, 100, sysdate, 100, 100, 0, 0 /total is calculated inside the procedure, but for now I need to add this argument/

I will see the same data

but if I enter

100, 101, sysdate, 200, 0, 0

I see

100, 101, sysdate, 101, 200, 0 , 300

Oracle overwrites first entered record and I want all changes to be written in the same table.
# 4  
Old 01-21-2013
What does the procedure look like?

tyler_durden
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Recompile PL/SQL Procedure through UNIX

Hi, We have a procedure e.g. prc_synonym created in Oracle 12c Database. I want to do small change in procedure through Unix. I have that changed procedure (prc_synonym) in proc.sql file. Want to recompile that procedure through Unix so that changes should reflect in existing procedure in... (10 Replies)
Discussion started by: Aparna.N
10 Replies

2. UNIX for Dummies Questions & Answers

Emailing results of a pl sql procedure from UNIX shell script

Hello All, I am writing the below unix script to email the result of a small pl sql procedure: #!/bin/bash ORACLE_HOME=/opt/oracle/orcts/product/9.2.0; export ORACLE_HOME SQLPLUS=$ORACLE_HOME/bin/sqlplus sqlplus -s user/pass@Db_instance<<EOF set echo off set feedback off set pages 0... (9 Replies)
Discussion started by: Bunty bedi
9 Replies

3. Programming

Sql Procedure in Pro C file

Hi, Can any one help me how to write a sql procedure in a pro *c file for selecting the data from a database and inserting the rows into a queue in a .pc file. thanx in advance. (1 Reply)
Discussion started by: jhon1257
1 Replies

4. Shell Programming and Scripting

Help to get the Output of PL/SQL procedure In a Excel or Text File

Hi, Could anyone please guide me to get the output of the PL/SQL procedure in a Excel file or Text File... Thanks (1 Reply)
Discussion started by: funonnet
1 Replies

5. Shell Programming and Scripting

calling pl/sql procedure from shell and return values

How could I call an Oracle PL/SQL procedure from any shell (bash) and catch returning value from that procedure (out param) or get a returning value if it's a function. also, I got into trouble when I tried to send a number as a param #!/bin/bash -e username=$1 pwd=$2 baza=$3... (0 Replies)
Discussion started by: bongo
0 Replies

6. Programming

Help with pl/sql stored procedure

Hi, Can anyone please let me know where to check if a particular stored procedure exists. If the procedure exists I want to display some message and if the procedure does not exists i want to exit with error message. checking from dba_objects doesnt help. suprisingly the procedure i... (3 Replies)
Discussion started by: justchill
3 Replies

7. Shell Programming and Scripting

calling a PL/SQL stored procedure from KSH

Hi I have a stored procedure which should be called from KSH. Could ayone please help me with this. Thanks (1 Reply)
Discussion started by: BlAhEr
1 Replies

8. UNIX for Dummies Questions & Answers

Running PL/SQL procedure via unix

All, I have a 10g PL/SQL procedure that needs to be run via a unix script. How could such a script be developed. Thanks Aditya. (1 Reply)
Discussion started by: kingofprussia
1 Replies

9. UNIX for Advanced & Expert Users

How to call SQL procedure from UNIX Shellscript ?

Hi All I would be thankful to you all if you will guide me the steps to call a stored proc. from unix shell script. that stored proc. could be parameterised or parameterless developed in SQL. Any info. in this topic would help me..... Thanks in advance.... (1 Reply)
Discussion started by: varungupta
1 Replies

10. Shell Programming and Scripting

return variable from PL/SQL procedure to shell

Hi i'm calling a pl/sql procedure which is returning one variable. i'm trying to assing this value to variable in shell script the code i wrote is ** in shell script** var= 'sqlplus user/pass @ret.sql' echo $var ** and variable dum_var number exec rt_test(:DUM_VAR); exit; in... (4 Replies)
Discussion started by: ap_gore79
4 Replies
Login or Register to Ask a Question