procedure

Block procedure PL/SQL with Oracle

元气小坏坏 提交于 2019-12-19 17:33:12
问题 I have a procedure and I would like that only one user could execute this procedure at same time. 回答1: This is just off the top of my head: Consider using a named lock via dbms_lock. http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_lock.htm#CHDICHDC Right after the begin statement get the lock, do the work, then release it on exit (Keep errors/exceptions in mind!). KT 回答2: A simple solution can be to use lock at the table level, by using FOR UPDATE. 来源: https://stackoverflow

Block procedure PL/SQL with Oracle

倾然丶 夕夏残阳落幕 提交于 2019-12-19 17:32:05
问题 I have a procedure and I would like that only one user could execute this procedure at same time. 回答1: This is just off the top of my head: Consider using a named lock via dbms_lock. http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_lock.htm#CHDICHDC Right after the begin statement get the lock, do the work, then release it on exit (Keep errors/exceptions in mind!). KT 回答2: A simple solution can be to use lock at the table level, by using FOR UPDATE. 来源: https://stackoverflow

Oracle insert into table2 then delete from table1, exception if fail

爷,独闯天下 提交于 2019-12-18 09:45:29
问题 creating a procedure that will insert the data from my table1 into my table2 and delete it after insert, or in case the table2 has reached its limit then i will create a new backup table. I have two tables sii_bck_cfg_tab and sii_bck_tab On cfg_tab i have a list of table_names with a couple of columns (id,name_tab, prefix_tab, created_on , keep_days, max_rows_bck) prefix_tab- where i get the prefix when i need to create a new backup table keep_days- the number of days i want to keep the

Problem with execute procedure in PL/SQL Developer

我们两清 提交于 2019-12-18 07:38:09
问题 I this is my first attempt to create procedure and execute it. First I create simple table. DB scheme of table is here: Table name: Ziaci Columns: ZiakId - primary key, number Surname, varchar2 FirstName, varchar2 TriedaId - forgein key, number Store procedure only insert data in table, I created store procudure with this SQL cmd: create procedure ziaci_proc(surname_in in varchar2, firstname_in in varchar2, triedaid_in in number) is begin insert into ziaci (surname, firstname,triedaid) values

Problem with execute procedure in PL/SQL Developer

大憨熊 提交于 2019-12-18 07:38:04
问题 I this is my first attempt to create procedure and execute it. First I create simple table. DB scheme of table is here: Table name: Ziaci Columns: ZiakId - primary key, number Surname, varchar2 FirstName, varchar2 TriedaId - forgein key, number Store procedure only insert data in table, I created store procudure with this SQL cmd: create procedure ziaci_proc(surname_in in varchar2, firstname_in in varchar2, triedaid_in in number) is begin insert into ziaci (surname, firstname,triedaid) values

Creating a procedure in mySql with parameters

六月ゝ 毕业季﹏ 提交于 2019-12-17 22:44:46
问题 I am trying to make a stored procedure using mySQL. This procedure will validate a username and a password. I'm currently running mySQL 5.0.32 so it should be possible to create procedures. Heres the code I've used. All I get is an SQL syntax error. GO CREATE PROCEDURE checkUser (IN @brugernavn varchar(64)),IN @password varchar(64)) BEGIN SELECT COUNT(*) FROM bruger WHERE bruger.brugernavn=@brugernavn AND bruger.pass=@Password; END; Thank you in advance 回答1: I figured it out now. Here's the

What are the differences between “recursion”, “a non-terminating procedure that happens to refer to itself”, and “repeated scheduling”? [closed]

╄→гoц情女王★ 提交于 2019-12-17 20:28:10
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . This Question is intended as a canonical Question/Answer for disambiguation as to the descriptive term "recursion", or "recursive". And to the extent applicable, "a non-terminating procedure that happens to refer to itself" and "repeated scheduling". In JavaScript what are the

ORA-00900: invalid SQL statement- when run a procedure in oracle 10g

[亡魂溺海] 提交于 2019-12-17 19:13:43
问题 I am using Oracle 10g database and trying to run a procedure using SQL commands. create or replace procedure "exam" is begin DBMS_OUTPUT.PUT_LINE('Test'); end; Then click on Run button. It shows: "procedure created". When I try to execute it using: execute exam; then click on Run button, it shows: ORA-00900: invalid SQL statement Thanks for your help. 回答1: Just noticed a detail in your question. You press run button. Thus, you must be using an IDE. You cannot use execute in IDEs - it is an

MySQL - Define a variable within select and use it within the same select

这一生的挚爱 提交于 2019-12-17 06:09:11
问题 Is there a possibility to do something like this? SELECT @z:=SUM(item), 2*@z FROM TableA; I always get NULL for the second column. The strange thing is, that while doing something like SELECT @z:=someProcedure(item), 2*@z FROM TableA; everything works as expected. Why? 回答1: MySQL documentation is quite clear on this: As a general rule, you should never assign a value to a user variable and read the value within the same statement. You might get the results you expect, but this is not

convert to PROCEDURE pl/sql

微笑、不失礼 提交于 2019-12-14 04:14:42
问题 I want to Write a PROCEDURE that will first print the Employee Number and Salary of an employee (i.e. 7839). Then it will increase the salary of an employee 7839 (this will be employee number in the table employee) as per following conditions: Condition-1: If experience is more than 10 years, increase salary by 20%. Condition-2: If experience is greater than 5 years, increase salary by 10%. Condition-3: All others will get an increase of 5% in the salary. The program will print the Employee