Objective: Use a persistent BLOB locator to erase a byte range, verify the value, and undo the change.
This is a 10-point self-assessment. Submit your SQL and explanation to compare them with the model answer. This website does not connect to Oracle or execute submitted code.
Use your own Oracle AI Database 26ai practice schema with CREATE TABLE permission, tablespace quota, and access to DBMS_LOB. Use SQL*Plus, SQLcl, or a compatible script runner. Disable autocommit and use the same session throughout. Start with no unrelated uncommitted work: setup includes DDL and COMMIT.
Create this dedicated table once. The BLOB contains five known bytes, not a real photograph. If this table already exists, use a fresh practice schema or your existing unchanged practice row; do not overwrite unrelated data.
CREATE TABLE lesson9_erase_practice (
product_id NUMBER PRIMARY KEY,
payload BLOB
);
INSERT INTO lesson9_erase_practice (product_id, payload)
VALUES (901, HEXTORAW('1122334455'));
COMMIT;Confirm the starting value with this query. Expect product 901, byte length 5, and hexadecimal 1122334455.
SELECT product_id,
DBMS_LOB.GETLENGTH(payload) AS byte_length,
RAWTOHEX(DBMS_LOB.SUBSTR(payload, 5, 1)) AS hex_bytes
FROM lesson9_erase_practice
WHERE product_id = 901;
Positions 2 and 3 become zero bytes; positions 1, 4, and 5 stay unchanged. The amount returned is 2 and the length stays 5.
Reference: Oracle AI Database 26ai DBMS_LOB documentation.