Skip to main content

DISCONTINUE (bSQL) | Blockpoint Docs

Removes a single or set of records from the current state of a blockchain. For examples, see Examples.

bSQL Syntax Conventions

Syntax

-- Syntax for discontinue - Blockchain Mutation 

DISCONTINUE
{
<object>
{
[ ( column_list ) ]
{ VALUES ( [ ,...n ] ) [ , ( [ ,...n ] )... ]
}
}
}

<object> ::=
{
database_name.blockchain_name
| blockchain_name
}

Arguments

database_name
Is the name of the database.

blockchain_name
Is the name of the target blockchain.

(column_list)
Is a list of one or more columns in which to discontinue data. column_list must be enclosed in parentheses and delimited by commas.
The the columns must reference the primary keys of the blockchain whose values reference the record to disconnect.

VALUES
Introduces the list or lists of data values to be discontinued. There must be one data value for each column in column_list, if specified, or in the blokcchain. The value list must be enclosed in parentheses.

If the values in the Value list are not in the same order as the columns in the blockchain or do not have a value for each column in the blockchain, column_list must be used to explicitly specify the column that stores value.

Limitations and Restrictions

  • The records discontinued must share a primary key with a record in the target blockchain.
  • The command may fail if it violates a trigger or tries to remove a row referenced by data in another table with a FOREIGN KEY constraint. If the DELETE removes multiple rows, and any one of the removed rows violates a trigger or constraint, the statement is canceled, an error is returned, and no rows are removed.

Permissions

DISCONTINUE or WRITE permission required on the target blockchain.

DISCONTINUE permissions default to members of the admin and developer fixed database roles. Members of the admin role can transfer permissions to other users.

Examples

### Basic SyntaxExamples in this section demonstrate the basic functionality of the discontinue statement using the minimum required syntax. #### A. Discontinuing a single record The following example discontinues a single record. The values associated with the primary key `MMM` will be removed from the state of the blockchain. This example uses the Financial [Demo Database](/docs/demo_database). ```sql DISCONTINUE financial.companies (symbol) VALUES ("MMM") ``` #### B. Discontinuing multiple records of data The following example discontinues the two records associated with the primary keys `ZION` and `ZMH`.

This example uses the Financial Demo Database.

DISCONTINUE financial.companies (symbol)
VALUES ("ZION"), ("ZMH")

C. Discontinuing data that is not in the same order as the blockchain columns

The following example uses a column list to explicitly specify the value to be discontinued.

This example uses the Financial Demo Database.

DISCONTINUE financial.companies (sectos, name)
VALUES ("Financials", "AIZ")

D. Discontinuing using complete records

The following example uses two complete records to discontinue them in the blockchain.

This example uses the Financial Demo Database.

DISCONTINUE financial.companies
VALUES ("AES", "AES Corp", "Utilities"),
("ADP", "Automatic Data Processing", "Information Technology")

See Also