How to get applied stored procedure for inserted row in mysql php query

$ query = "CREATE PROCEDURE IF NOT EXISTS Insertion(IN firstname varchar(40),IN lastname varchar(40),IN email varchar(40),IN department varchar(40),IN doj date,IN basicpay int(11)) BEGIN

DECLARE HRA decimal(20,2); DECLARE DA decimal(20,2); DECLARE PF decimal(20,2); DECLARE NET_SALARY decimal(20,2);

IF department = ‘HUMAN RESOURCE’ THEN SET HRA = (5/100)*basicpay; SET DA = (7/100)*basicpay; SET PF = (10/100)*basicpay;

ELSEIF department = ‘MARKETING’ THEN SET HRA = (5/100)*basicpay; SET DA = (7/100)*basicpay; SET PF = (10/100)*basicpay;

ELSEIF department = ‘PRODUCTION’ THEN SET HRA = (5/100)*basicpay; SET DA = (7/100)*basicpay; SET PF = (10/100)*basicpay;

ELSEIF department = ‘FINANCE AND ACCOUNTING’ THEN SET HRA = (5/100)*basicpay; SET DA = (7/100)*basicpay; SET PF = (10/100)*basicpay;

ELSE SET HRA = (5/100)*basicpay; SET DA = (7/100)*basicpay; SET PF = (10/100)*basicpay;

END IF; SET NET_SALARY = basicpay+HRA + DA + PF;

insert into employees(FIRST_NAME,LAST_NAME,EMAIL,DEPARTMENT,DATE_OF_JOINING,BASIC_PAY,HRA,DA,PF,NET_SALARY) values(firstname,lastname,email,department,doj,basicpay,HRA,DA,PF,NET_SALARY);

END";

Can a user benefit from personal powers stored in an empowered object?

I realized while writing this question that I have another issue with empowered objects. Specifically, it is the object using the stored powers, rather than the wearer/wielder/user. Can such an object "target" the user with personal or "self-only" powers? I intend to have a more powerful psionic NPC loan a PC a Psychometabolic item, but most of the powers it’ll have access to are self-targeting and I realized I wasn’t sure if the PC could even use them.

Pause and resume execution of stored procedure

There are two processes(p1, p2) that may run simultaneously. p2 is a scheduled execution of SPROC while p1 consists of a group of stored procedures that is triggered on the request. Execution of p1 while p2 is in progress can create issues. Only one should run at a time. There are three ways to solve this problem

  1. When p1 starts check whether p2 is in progress and wait until it completes. p2 can run for more than a day and it might not be a preferable solution
  2. Kill p2, complete p1 and then restart p2. Killing and restarting p2 isn’t safe due to nature of the sproc
  3. pause p2 and resume p2 when p1 completes

Questions

1. How can I search and stop store procedure being executed?

2. Is there any way I can pause and resume a stored procedure that is being executed?

Strange behaviour on stored procedure

I have the following mysql stored procedure:

DELIMITER // CREATE PROCEDURE INSERT_INTO_WORKDAY(IN deviceName VARCHAR(16), IN cardUID VARCHAR(14))  BEGIN     SET @projectId = (SELECT MIN(ID) FROM PROJECT WHERE DEVICEID = (SELECT MIN(ID) FROM DEVICE WHERE NAME = deviceName) ORDER BY ID DESC LIMIT 1);     SET @workerId = (SELECT MIN(ID) FROM WORKER WHERE CARDNUMBER = cardUID);     SELECT @workerId;          SET @id = (SELECT MIN(ID) FROM WORKDAY WHERE WORKERID = @workerId AND PROJECTID = @projectId AND STOPTIME IS NULL AND STARTTIME IS NOT NULL);     IF (@id >= 0)         THEN             UPDATE WORKDAY SET STOPTIME = now() WHERE ID = @id;     ELSE         INSERT INTO WORKDAY (WORKERID, PROJECTID, STARTTIME) VALUES (@workerId, @projectId, now());     END IF; END; // DELIMITER ; 

When I call the procedure once, I get the result:

mysql> CALL INSERT_INTO_WORKDAY("Pepper_C1-1A6318", "045D91B22C5E80"); +-----------+ | @workerId | +-----------+ |         1 | +-----------+ 1 row in set (0.01 sec)  Query OK, 1 row affected (0.09 sec) 

From second run, is not working anymore:

mysql> CALL INSERT_INTO_WORKDAY("Pepper_C1-1A6318", "045D91B22C5E80"); +-----------+ | @workerId | +-----------+ |      NULL | +-----------+ 1 row in set (0.00 sec)  ERROR 1048 (23000): Column 'WORKERID' cannot be null 

I did try to isolate and run the procedure with only this two lines of code:

    SET @workerId = (SELECT MIN(ID) FROM WORKER WHERE CARDNUMBER = cardUID);     SELECT @workerId; 

And it behaves just like above, but if I try to run SELECT MIN(ID) FROM WORKER WHERE CARDNUMBER = "045D91B22C5E80"; alone, works without problems. The @projectId variable behaves normal everytime I call the stored procedure.

Can someone help me to find a solution? Thank you!

My setup:

mihai:~$   mysql -V mysql  Ver 8.0.22-0ubuntu0.20.04.3 for Linux on x86_64 ((Ubuntu)) 
mysql> describe WORKER; +------------+-------------+------+-----+---------+----------------+ | Field      | Type        | Null | Key | Default | Extra          | +------------+-------------+------+-----+---------+----------------+ | ID         | int         | NO   | PRI | NULL    | auto_increment | | FIRSTNAME  | varchar(15) | NO   |     | NULL    |                | | LASTNAME   | varchar(20) | NO   |     | NULL    |                | | CARDNUMBER | varchar(14) | NO   |     | NULL    |                | | POSITIONID | int         | NO   | MUL | NULL    |                | +------------+-------------+------+-----+---------+----------------+ 5 rows in set (0.01 sec) 

Java stored procedure or user-defined function could not call Java method

After I created a Java external stored procedure in DB2 as in my previous question, the call

call user1.send_mail(    P_TO          => 'me@domain.com'   ,P_CC          => NULL   ,P_BCC         => NULL   ,P_FROM        => 'me@domain.com'   ,P_SUBJECT     => 'db2 java subject'   ,P_TEXT_MSG    => 'db2 java test'   ,P_HTML_MSG    => null   ,P_ATTACH_NAME => null   ,P_ATTACH_MIME => null   ,P_ATTACH_BLOB => null   ,P_SMTP_HOST   => 'domain.com'   ,P_SMTP_PORT   => 465   ,P_USER_NAME   => 'me@domain.com'   ,P_PASSWORD    => 'secret'); 

fails it due to the following error:

Java stored procedure or user-defined function "USER1.SEND_MAIL", specific name "SQL201208113215436" could not call Java method "send_mail", signature "(Ljava/lang/String".. SQLCODE=-4306, SQLSTATE=42724, DRIVER=3.68.61

I made sure that all parameters that have no default values receive non-NULL values. What else is necessary for this to work?

How can I call a SQL Server stored procedure from Oracle and retrieve a scalar return value?

I’m developing a PL/SQL solution in Oracle Database Enterprise Edition 12.1.0.2. I’m calling stored procedures in Microsoft SQL Server 2014.

I am using DG4ODBC with the DBMS_HS_PASSTHROUGH package to call those stored procedures.

For stored procedures that return a tabular result set, I am able to use PARSE, FETCH_ROW, and GET_VALUE to retrieve the values. (My solution uses hard parsing, but it works for the volume we’re expecting. I’m open to tips if you know how I can use binds, but that’s not my question.)

DECLARE    sql_server_cursor_     BINARY_INTEGER;    sql_server_statement_  VARCHAR2(32767);    fetched_value_col1_    whatever_type_from_col1;    fetched_value_col2_    whatever_type_from_col2; BEGIN    sql_server_statement_ := 'EXEC "myDatabase"."dbo"."myProcedure" @p_one = N''' || sanitize__(my_argument_) || ''';';    sql_server_cursor_ := dbms_hs_passthrough.open_cursor@sql_server_link_;    dbms_hs_passthrough.parse@sql_server_link_(sql_server_cursor_, sql_server_statement_);    WHILE dbms_hs_passthrough.fetch_row@sql_server_link_(sql_server_cursor_) > 0    LOOP       dbms_hs_passthrough.get_value@sql_server_link_(sql_server_cursor_,  1, fetched_value_col1_);       dbms_hs_passthrough.get_value@sql_server_link_(sql_server_cursor_,  2, fetched_value_col2_);       dbms_output.put_line('fetched_value_col1_  ' || fetched_value_col1_);       dbms_output.put_line('fetched_value_col2_  ' || fetched_value_col2_);    END LOOP;    dbms_hs_passthrough.close_cursor@sql_server_link_(sql_server_cursor_); END; / 

I have a stored procedure in SQL Server that returns a scalar integer.

DECLARE @return_value int; EXEC @return_value = "myDatabase"."dbo"."myProcedure" @p_one = N'HelloWorld', @p_two = 42; SELECT @return_value; 

From Oracle, how would I call this procedure and retrieve that scalar value?

Stored procedure runs fine when executed manually but fails in scheduled job

I have a stored procedure that runs fine when executed manually but fails in scheduled job. The error I receive is: Executed as user: \USER-a. Login failed for user ‘\USER-a’. [SQLSTATE 28000] (Error 18456). The step failed.

My other stored procedures runs fine when scheduled. The only stored procedures that fails are the ones that are written in this form.

SET @QUERY = ‘SELECT * from abc’

EXEC(@QUERY)

Is all data stored in computers stored as machine code?

I know that the most basic (and least abstract) code for programming is machine code (with binary of 0s and 1s being the typical machine code).

I also know that computers can save data even if they are turned off, by different types of computer memory (storage device memory, RAM and other computer system devices which can "remember" some data).

Is all data stored in computers ("all data remembered in a given computer memory") stored as machine code?
Is what’s saved in a computer’s "memory" (and becoming actually effective by electrical current correctly distributed to the computer system) just binary machine code in the sense that if I could read and understand that data directly without an operating system interfacing it for me it should appear in my mind as machine code, or rather, is it something else?

Is this Bracers of Stored Health magic item balanced?

I was thinking about the similarities between a character I was making and one from the Mistborn series by Brandon Sanderson, when the idea to make a magic item that replicated the effects of one of the powers in that series, Gold Feruchemy, which allows the user to store their health in pieces of gold, becoming sickly while storing, in order to be able to draw on the stored health later to heal faster. So I made this:

Bracers of Stored Health

Wondrous item, rare(requires attunement)

These ornate golden bracers can store the wearer’s health for later use. While wearing the bracers, you can use an action to take one of the following actions:

Store. You store 1 hit die into the bracers. After taking this action, you have disadvantage on Constitution saves for 2 rounds, and take 1 extra damage for each die rolled to deal damage to you in the same time frame. This effect stacks with consecutive uses of this action. A long rest will not restore any hit die stored up to an hour before starting the rest.

Tap. You can roll up to 5 stored hit die, healing for that amount. Alternatively, you can spend 1 hit die to cancel the debuff from 1 use of the Store action, or 3 hit die to cure yourself of 1 disease or condition that is affecting you. The condition can be blinded, deafened, paralyzed, or poisoned.

Some potential balancing options that I thought of are:

-If the Store action is too underpowered, making the Store action a bonus action instead.

-If the Store action is too overpowered, change it so that you instead store over a short or long rest, storing as many hit die as you want. Hit die stored during a long rest are not restored by it. The debuff would last for 10 minutes x the number of hit die stored, starting after the rest ends.

-Increasing/reducing the maximum number of hit die that can be used when taking the Tap action.

-Making it so that the Tap action can’t be taken on two consecutive turns

Does this seem balanced as it is, or does it need changes, either from the list I made or something I didn’t think of?

Virus / malware stored inside database

I have a small network of several Windows 10 machines (all protected by BitDefender 2020 Total Security), one of which acts as server with Firebird database.

For some time the database is deteriorating – in some random records some fields have altered values. I completly changed the server machine for a brand new with fresh Windows 10 installation and antivirus, on which the database was recreated from GBK archive. The primary machine was carefully check for RAM errors (with MemTest86) and SSD errors (CrystalDiskInfo and ADATA SSD ToolBox) – everything was in 100% fine.

I don’t have no suspicions other than that the server was hacked, but it looks like an alleged malware / virus must move inside database (even packed GBK archive), because only GBK file was moved to new machine (on verified pendrive).

Is it even possible that the virus is stored inside the database (e.g. in the form of stored procedures, etc.) and it transfers with GBK archive? If so, how to detect and remove it from database?

(Firebird database is stored in the form of single FDB file, which was scanned by BitDefender without any results)