# Technical Document Extraction: SQL Code Analysis
## Code Transcription
```python
from sqlfluff import lint
def test_rules_std_L060_raised() -> None:
try:
sql = "SELECT IFNULL(NULL, 100), NVL(NULL, 100);"
result = lint(sql, rules=["L060"])
assert len(result) == 2
except:
print("Other issues")
try:
assert result[0]["description"] == "Use 'COALESCE' instead of 'IFNULL'."
assert result[1]["description"] == "Use 'COALESCE' instead of 'NVL'."
print("Issue resolved")
except AssertionError:
print("Issue reproduced")
return
test_rules_std_L060_raised()
```
## Key Components
1. **Imports**:
- `from sqlfluff import lint`
*Imports the `lint` function from the `sqlfluff` library for SQL linting.*
2. **Function Definition**:
- `def test_rules_std_L060_raised() -> None:`
*Defines a test function with no return value.*
3. **SQL Query**:
```sql
SELECT IFNULL(NULL, 100), NVL(NULL, 100);
```
*Tests two NULL-handling functions: `IFNULL` (MySQL) and `NVL` (Oracle).*
4. **Linting Execution**:
- `result = lint(sql, rules=["L060"])`
*Applies rule `L060` (likely related to NULL handling) to the SQL query.*
5. **Assertions**:
- `assert len(result) == 2`
*Expects exactly two linting issues to be found.*
- `assert result[0]["description"] == "Use 'COALESCE' instead of 'IFNULL'."`
- `assert result[1]["description"] == "Use 'COALESCE' instead of 'NVL'."`
*Validates that the linting output matches expected error messages.*
6. **Error Handling**:
- `except: print("Other issues")`
*Catches general exceptions and prints a generic error message.*
- `except AssertionError: print("Issue reproduced")`
*Catches assertion failures and prints a specific error message.*
7. **Function Invocation**:
- `test_rules_std_L060_raised()`
*Executes the test function at the end of the script.*
## Observations
- **Color Coding**:
- Red text highlights function definitions, SQL keywords, and error messages.
- Blue text highlights assertions and print statements.
- This may indicate syntax highlighting in the original source.
- **Rule Reference**:
- `L060` is a rule identifier in `sqlfluff` (likely from the [SQLFluff Rule List](https://docs.sqlfluff.com/en/stable/rules/)).
- **Purpose**:
- The script tests whether `sqlfluff` correctly identifies deprecated NULL-handling functions (`IFNULL`, `NVL`) and suggests `COALESCE` as a replacement.
## Notes
- The code uses Python-style exception handling (`try/except`).
- The `lint` function returns a list of dictionaries containing linting results (e.g., `description` keys).
- The final `return` statement exits the function after execution.