teleren/devto huggingface dataset:
AntDB-Oracle Compatibility Developer's Manual P4–20
Published: 2023-09-26 15:20:53

#### DELETE

The DELETE command in standard SQL can also be used in SPL programs. Expressions in the SPL language can also be used where expressions appear in the DELETE command in standard SQL. Therefore, SPL variables and parameters can be used to provide values for the delete operation.

Prepare test data.

```
CREATE TABLE emp (
 empno NUMBER(4),
 ename VARCHAR2(10),
 job VARCHAR2(9),
 mgr NUMBER(4),
 hiredate DATE,
 sal NUMBER(7,2),
 comm NUMBER(7,2),
 deptno NUMBER(2)
);

INSERT INTO emp VALUES (7369,'SMITH','CLERK',7902,'17-DEC-80',800,NULL,20);
INSERT INTO emp(empno,ename,job,mgr,hiredate,sal,comm,deptno) VALUES (7499,'ALLEN','SALESMAN',7698,'20-FEB-81',1600,300,30);
INSERT INTO emp(empno,ename,job,mgr,hiredate,sal,deptno) VALUES (7389,'SMITH','CLERK',7902,'17-DEC-80',800,20);
```

Create a stored procedure.

```
\set PLSQL_MODE on
CREATE OR REPLACE PROCEDURE emp_delete (p_empno IN NUMBER)
IS
BEGIN
	DELETE FROM emp WHERE empno = p_empno;
	IF SQL%FOUND THEN
		DBMS_OUTPUT.PUT_LINE('Deleted Employee # : ' || p_empno);
	ELSE
		DBMS_OUTPUT.PUT_LINE('Employee # ' || p_empno || ' not found');
END IF;
END;
/
\set PLSQL_MODE off
```

The SQL%FOUND conditional expression returns "true" if a row is successfully deleted, otherwise it returns "false".

The following procedure performs a delete operation in the employee table.

```
postgres=# select emp_delete(7369);
NOTICE:  Deleted Employee # : 7369
 EMP_DELETE
------------

(1 row)
postgres=# select * from emp where empno=7369;
 EMPNO | ENAME | JOB | MGR | HIREDATE | SAL | COMM | DEPTNO
-------+-------+-----+-----+----------+-----+------+--------
(0 rows)
```
AntDB-Oracle Compatibility Developer’s Manual P4–18
Published: 2023-09-26 15:13:01

#### SELECT INTO

The SELECT INTO statement in SPL is not exactly the same as the SELECT command in standard SQL, as shown below.

- The purpose of the SELECT INTO statement is to assign the results to variables or records used in the SPL program.

- SELECT INTO can only access one row in the result set.

In addition to what is mentioned above, the clauses of the standard SQL SELECT command such as WHERE, ORDER BY, GROUP BY, HAVING can be used in SELECT INTO. Here are two different uses of the SELECT INTO statement.

SELECT select\_expressions INTO target FROM ...;

target is a comma-separated list of simple variables. select\_expressions and the rest of the statement are the same as the SELECT command in standard SQL. The data type, number, and order of the selected values must be the same as the structure of the target variables, otherwise there will be errors during program execution.

SELECT \* INTO record FROM table ... ;

record is a previously declared record type variable

If the query returns no records, then the null value is assigned to the target variable. If the query returns multiple records, the first record is assigned to the target variable and the rest of the records are discarded.

(Note that unless an ORDER BY statement is used, the "first data" is not really the first data)

(Note: SPL will generate an exception whether no rows are returned or more than one row is returned)

(Note: There is a different use of SELECT INTO where multiple rows in the result set can be returned to a collection by using the BULK COLLECT clause)

The WHEN NO\_DATA\_FOUND clause can be used in the exception handling block to confirm that the assignment was successful (i.e., that the query returned at least one row)

This version of the emp\_sal\_query procedure uses another use of the SELECT INTO statement to return the result set into a single row.

```
\set PLSQL_MODE on
CREATE OR REPLACE PROCEDURE emp_sal_query (p_empno IN NUMBER)
IS
	r_emp emp%ROWTYPE;
	v_avgsal emp.sal%TYPE;
BEGIN
	SELECT ename, job, hiredate, sal, deptno
		INTO r_emp.ename, r_emp.job, r_emp.hiredate, r_emp.sal, r_emp.deptno
		FROM emp WHERE empno = p_empno;
	DBMS_OUTPUT.PUT_LINE('Employee # : ' || p_empno);
	DBMS_OUTPUT.PUT_LINE('Name : ' || r_emp.ename);
	DBMS_OUTPUT.PUT_LINE('Job : ' || r_emp.job);
	DBMS_OUTPUT.PUT_LINE('Hire Date : ' || r_emp.hiredate);
	DBMS_OUTPUT.PUT_LINE('Salary : ' || r_emp.sal);
	DBMS_OUTPUT.PUT_LINE('Dept # : ' || r_emp.deptno);

	SELECT AVG(sal) INTO v_avgsal
		FROM emp WHERE deptno = r_emp.deptno;
	IF r_emp.sal > v_avgsal THEN
		DBMS_OUTPUT.PUT_LINE('Employee''s salary is more than the '|| 'department average of ' || v_avgsal);
	ELSE
		DBMS_OUTPUT.PUT_LINE('Employee''s salary does not exceed the '|| 'department average of ' || v_avgsal);
	END IF;

END;
/
\set PLSQL_MODE off
```
AntDB-Oracle Compatibility Developer’s Manual P4–17
Published: 2023-09-26 15:10:29

#### Assignment

The function of the assignment statement is to assign the computed expression to the left of the assignment symbol to the variable to the right of the assignment symbol := or to a formal parameter in IN or IN OUT mode.

variable := expression;

The variable argument is the identifier of the declared variable, which can be an OUT, or IN OUT mode formal parameter. The expression argument is an expression that produces a single value. The value generated by the expression must be compatible with the variable's data type.

The dept\_salary\_rpt example shows the assignment statement at variable declaration time. What is different in this example is the way the assignment statement is used in the procedure execution.

```
\set PLSQL_MODE on
CREATE OR REPLACE PROCEDURE dept_salary_rpt (p_deptno NUMBER)
IS
	todays_date DATE;
	rpt_title VARCHAR2(60);
	base_sal INTEGER;
	base_comm_rate NUMBER;
	base_annual NUMBER;
BEGIN
	todays_date := SYSDATE;
	rpt_title := 'Report For Department # ' || p_deptno || ' on '|| todays_date;
	base_sal := 35525;
	base_comm_rate := 1.33333;
	base_annual := ROUND(base_sal * base_comm_rate, 2);

	DBMS_OUTPUT.PUT_LINE(rpt_title);
	DBMS_OUTPUT.PUT_LINE('Base Annual Salary: ' || base_annual);
END;
/
\set PLSQL_MODE off
```
AntDB-Oracle Compatibility Developer’s Manual P4–16
Published: 2023-09-26 15:07:15

### **Basic Statements**

This section begins the discussion of programming statements used in SPL programs.

#### NULL

The simplest statement is the NULL statement. This statement is an execution statement and does not produce an actual operation.

NULL;

The following is the simplest SPL program.

```
BEGIN  
  NULL;
END;
```

When a statement like IF-THEN-ELSE is executed, the NULL statement can operate as a placeholder.

**Example:**

```
\set PLSQL_MODE on
CREATE OR REPLACE PROCEDURE divide_it (
	p_numerator IN NUMBER,
	p_denominator IN NUMBER,
	p_result OUT NUMBER
)
IS
BEGIN
	IF p_denominator = 0 THEN
		NULL;
	ELSE
		p_result := p_numerator / p_denominator;
END IF;
END;
/
\set PLSQL_MODE off
```
Testing Technique
Published: 2023-09-26 15:02:08

Testing Technique
   It has four types - Boundry value analysis; Decision Table Testing; Use Case Testing; LCSAJ Testing

Boundry Value Analysis (BVA):
     Boundry value analysis is a software testing technique used to identify and test values at the boundaries of input. It's particularly used for finding the error and defect. BVA is commonly applied for SDLC.


Key concepts of BVA
  Identify input boundaries
  Selecting test cases 
  Testing
  Validation
  Error detection
  Documentation 

Ex- The application accept of two values and provide their sum.The valid input range of each number is 1 to 100
Valid input - 
  Minimum value is 1 and Maximum value is 100
Invalid input -
  Less than the minimum (0 and 101)
  Greater than the maximum (101 and 0)

Decision Table Testing:
   Decision table testing is a technique used in software testing to assesment different combinations of input condition and corresponding outcomes
 Formula - 2^n

Example - 
 To voting for an election have 2 condition
 1.He/ She should be an indian citizen
 2.Age bove 18

2^2 = 4

Input                  Output
Citizen Age>18  Elegible to vote 
                      or Not
True.     True.         True
True.     False.        False
False.    True.         False
False.    False.        True

USE Case Testing -
  Use case Testing is a software testing technique that focus on testing system. It ensures that the software function correctly and fill the requirements

Example:
 Place an order on E-Commerce 

Condition
 User logged in 
 Product shows on catalog 

Steps
 Log in to the app - search a product - select the a searched product - proceed to cart - click checkout button - enter shipping and payment details - then click place the order

Results
 Received the order confirmation
 A e-mail conformation should be sent
LCSAJ Testing 
  LCSAJ Testing is a white box testing technique to identify the code coverage which begins at the start of the program and end of the program
AntDB-Oracle Compatibility Developer’s Manual P4–15
Published: 2023-09-26 14:57:19

#### Using %ROWTYPE in a record declaration

Using the %TYPE attribute provides an easy way to create variables that are determined by the column data type. By using the %ROWTYPE attribute, you can define a record type that contains fields corresponding to each column in a given table. The data type of each field is the same as the data type of the corresponding column.

Note: Fields in a record do not inherit any other attributes from the column, such as the NOT NULL clause or the DEFAULT clause.

A record is a collection of fields that are named and stored sequentially. A field is similar to a variable in that it has an identifying name and data type, but it also has additional attributes that belong to the record and must be qualified by both the record name with a '.' record name as a qualifier.

A record type can be declared by using the %ROWTYPE attribute. % The ROWTYPE attribute is prefixed with the name of the table. Each column in the named table defines a field of the same name, data type in the record.

record table%ROWTYPE;

record is the identifier assigned to the record. table is the name of the table whose columns we will use to define the fields in the record, and views can also be used to define records. The following example shows the use of emp%ROWTYPE to modify the emp\_sal\_query procedure from the previous section to create a record named r\_emp, rather than declaring a separate variable for each column in the emp table.

```
\set PLSQL_MODE on
CREATE OR REPLACE PROCEDURE emp_sal_query (p_empno IN NUMBER)
IS
	r_emp emp%ROWTYPE;
	v_avgsal emp.sal%TYPE;
BEGIN
	SELECT ename, job, hiredate, sal, deptno
		INTO r_emp.ename, r_emp.job, r_emp.hiredate, r_emp.sal, r_emp.deptno
		FROM emp WHERE empno = p_empno;
	DBMS_OUTPUT.PUT_LINE('Employee # : ' || p_empno);
	DBMS_OUTPUT.PUT_LINE('Name : ' || r_emp.ename);
	DBMS_OUTPUT.PUT_LINE('Job : ' || r_emp.job);
	DBMS_OUTPUT.PUT_LINE('Hire Date : ' || r_emp.hiredate);
	DBMS_OUTPUT.PUT_LINE('Salary : ' || r_emp.sal);
	DBMS_OUTPUT.PUT_LINE('Dept # : ' || r_emp.deptno);

	SELECT AVG(sal) INTO v_avgsal
		FROM emp WHERE deptno = r_emp.deptno;
	IF r_emp.sal > v_avgsal THEN
		DBMS_OUTPUT.PUT_LINE('Employee''s salary is more than the '|| 'department average of ' || v_avgsal);
	ELSE
		DBMS_OUTPUT.PUT_LINE('Employee''s salary does not exceed the '|| 'department average of ' || v_avgsal);
END IF;
END;
/
\set PLSQL_MODE off
```
"TypeScript and process.env: A Match Made in Node.js Heaven"
Tags: typescript, node
Published: 2023-09-26 14:54:27

**Introduction:**

Elevate your Node.js configuration game in just two simple steps! In this guide, we'll walk you through the process of adding TypeScript types to `process.env`, ensuring type safety and minimizing runtime errors. Transform your environment variables into a robust and error-resistant asset for your Node.js applications.

### Step:1 
Create `/types/env.d.ts` in the root of your project.
and add your types in `ProcessEnv` interface as shown below.

`/types/env.d.ts`
```ts
export {};

declare global {
  namespace NodeJS {
    interface ProcessEnv {
      SUPABASE_ANON_KEY: string;
      SUPABASE_PROJECT_URL: string;
      ENV: "test" | "dev" | "prod";
    }
  }
}
```
### Step:2 
you have created types of your `process.env` but typescipt dont know where you defined it , so add your types to `ts.config.json` as shown below.

`ts.config.json`
```ts
{
  "compilerOptions": {
    "typeRoots": ["./node_modules/@types", "./types"]
  }
}

```
🎉🎉 you have added types to your `process.env`.
you can check it in your code editor by auto suggestions.
![process.env of nodejs code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ovz7muiovdu6b1lxw3l.png)
AntDB-Oracle Compatibility Developer's Manual P4–13
Published: 2023-09-26 14:51:33

#### Declare a Variable

In general, all variables that are used in a block of code must be declared in the declaration section. A variable declaration consists of the variable name and its data type (see Section 2.2 for a discussion of data types). A variable can be initialized with a default value at the same time as the variable declaration.

The syntax rules for variable declarations are as follows.

name type \[ { := \| DEFAULT } { expression \| NULL } ];

name is the identifier assigned to the variable. type is the data type assigned to the variable. If \[ := expression ] occurs, then when the process enters the block, an initialized value is assigned to the variable, otherwise, the variable is automatically initialized to a null value in SQL.

The default value is calculated each time the block is entered. For example, when assigning SYSDATE to a variable of type DATE, the value of this variable is the current time, not the time value after the procedure or function has been precompiled and completed.

The following procedure demonstrates a number of variable declarations that use default values consisting of strings and numeric expressions.

```
\set PLSQL_MODE on
CREATE OR REPLACE PROCEDURE dept_salary_rpt (p_deptno NUMBER)
IS
todays_date DATE := SYSDATE;
rpt_title VARCHAR2(60) := 'Report For Department # ' || p_deptno|| ' on ' || todays_date;
base_sal INTEGER := 35525;
base_comm_rate NUMBER := 1.33333;
base_annual NUMBER := ROUND(base_sal * base_comm_rate, 2);
BEGIN
DBMS_OUTPUT.PUT_LINE(rpt_title);
DBMS_OUTPUT.PUT_LINE('Base Annual Salary: ' || base_annual);
END;
/
\set PLSQL_MODE off
```

The output of the procedure above shows that the default value used in the variable declaration has been assigned to the variable.

```
postgres=# select dept_salary_rpt(20);
NOTICE:  Report For Department # 20 on 2020-09-01 10:31:00
NOTICE:  Base Annual Salary: 47366.55
 DEPT_SALARY_RPT
-----------------

(1 row)
```
AntDB-Oracle Compatibility Developer's Manual P4–12
Published: 2023-09-26 14:47:37

##### Database object permissions

When starting the execution of an SPL program, before accessing the database objects that appear in the program, a permission check operation is performed to ensure that the current user has the appropriate operating privileges on the referenced objects. The GRANT and REVOKE commands are used to grant and revoke permissions on database objects, respectively. If the current user tries to access an unauthorized data object, then the program will generate an exception.

### **Variable Declaration**

SPL is a programming language structured as a code block. The first section that appears in the code block is the declaration section. The declaration section contains the definitions of variables, cursors, and other types of SPL statements that can be included in this block. In this section, the declaration of variables is discussed in more detail.
AntDB-Oracle Compatibility Developer's Manual P4–11
Published: 2023-09-26 14:41:31

##### Data Object Naming Parsing

Database objects in SPL programs can be referenced by either qualified or unqualified names. A qualified name is of the form schema.name, where schema is the name of the schema to which the database object belongs with the identifier "name". Unqualified names do not have a "schema." part. When a reference is made to a qualified name, there is no ambiguity in the reference to the object, which either exists or does not exist in the specified schema.

If you use an unqualified name to locate an object, you will be asked to use the current user's search path. When a user becomes the current user of a session, the default search path is used to associate with this user. The search path consists of a list of patterns, and the search order is left-to-right when locating references to data objects with unqualified names. If the corresponding object is not found in all schemas of the search path, it is assumed that the object does not exist. The SHOW search\_path command can be used in PSQL to display the default search path.

```
SHOW search_path;
search_path
----------------------
$user,public,sys,dbo
(1 row)
```

In the search path shown above, $user is a normal placeholder for the current session user, so if the current user in the session above is AntDB. Then search for a database object with an unqualified name in the following order in the following schema-first AntDB, then public, then sys, and finally dbo.

When an unqualified database object name can be resolved on the search path, it is possible to confirm whether the current user has permission to perform the corresponding operation on the specified object.

Note: The concept of search paths is not compatible with Oracle. For an unqualified reference, Oracle only searches for the relevant named database object in the current user's schema. It is also important to note that in Oracle, a user and the schema to which they belong belong belong to the same entity, however, in AntDB, the user and the schema belong to two different objects.
Top 5 Programming Languages to Learn in 2024
Published: 2023-09-26 14:13:18

The technological landscape always evolves and is everchanging. 
Similarly, the trend of languages also changes. 

Based on current trends and market predictions, the top five programming languages predicted to be in high demand in 2024 are:

**1. Python**: Known for its simplicity and versatility, Python continues to be a popular choice for data analysis, artificial intelligence, and machine learning.

**2. JavaScript**: With the rise of online applications and the dominance of front-end development, JavaScript continues to be an important language for creating interactive and dynamic web pages.

**3. Go**: Go's popularity for systems and network programming can be attributed to its efficiency, strong support for concurrent programming, well-designed standard library, portability, and backing from Google. Its simplicity and focus on readability also contribute to its appeal, making it an excellent choice for building scalable, high-performance, and concurrent software systems.

**4. Rust**: Rust's ownership system is a groundbreaking feature that ensures memory safety without the need for a garbage collector. It enforces strict rules at compile time, preventing common issues like null pointer dereferences, data races, and buffer overflows

**5. Java**: Java's design and architecture make it well-suited for building large and complex applications. It's object-oriented programming (OOP) features, modular structure, and strong typing allow developers to design scalable and maintainable codebases

In conclusion, the programming languages landscape is ever-evolving, and it's important for developers and aspiring programmers to stay updated with the latest trends.
Software Testing
Published: 2023-09-26 14:08:10

SOFTWARE TESTING:    
     Software testing means testing process that verify the developed software product by the developer.   
     Software testing is to ensure that good products are delivered to the customer before deploying. 
     It has two methods - Manual Testing and Automation testing 

MANUAL TESTING:
     Manual Testing means write and executed the test cases without the help of any automated tool support.   

AUTOMATION TESTING:
     It means write and execute the test scripts with the help of automated tool support (Selenium/Appium) and development language (Java/python)

Need to know about software testing:

Software testing methodologies:
     White box - Its used by the developer
     Black box - Its used by the tester
     Grey box  - Its used by both the developer and tester

Software development life cycle:
      Its to deliver a high quality product with low cost and possible duration of time. It has six phase. there are
                 1.Requirement analysis and planning  
                 2.Design 
                 3.Development
                 4.Testing
                 5. Deployment
                 6. Maintenance 
Testing can be done at the stage of  - the initial stage of Software development life cycle (SDLC); the test plan and the test case once done and approved by the lead; Once the developer build the product.
      
Testing can be stop/finish at the stage of - when there is no high priority and high severity defect; Functional and coverage has reached certain points 

Testing without the tester:     
      Developer can test the program and its name is unit testing
      Leads can test the program and its name is Exploratory testing
      User can use the product - User acceptance testing (UAT)

Relevance of software testing:
    Quality Assurance - Testing helps identifies defects and reducing the bugs
    User satisfaction - Quality software leads to customer satisfied 
    Cost saving - testing helps minimize post release maintenance and support cost 
    Brand Reputation - Testing helps prevent public embarrassment and lost of trust
GITHUB SNAKE RUN
Tags: codepen
Published: 2023-09-26 13:44:39

<p>Snake in quest of GitHub’s  Timesquares! The game unfolds with fully auto-generated, unpredictable charm.</p>

<p>Your mission is to guide the snake to victory, without it touching anything... tweaks to variables are your only ally! 🕹️</p>

<p>Explore more and fork if it catches your fancy: <a href="https://github.com/SECRET-GUEST" target="_blank">https://github.com/SECRET-GUEST</a></p>

{% codepen https://codepen.io/SECRET-GUEST/pen/LYMdgGY %}
The Golden Assumptions of Product Design
Tags: ux, ui, design, webdev
Published: 2023-09-26 13:28:59

The user is a creature which is:

1. Largely ignorant.

2. Inexperienced.

3. Lazy.

4. Immediately forgetful.

5. Often, and at any time, regretful.

6. Habitual.

7. Irrationally pain & loss-avoiding.

8. Irrationally pleasure- and joy-seeking.

And that's OK. There is nothing wrong with users. But this is the _baseline_ you should assume when you design.

So, to address each point (in slam-poetry style):


1. _**Show**_ them, don't just tell. When they need it.

2. _**Teach**_ them; don't _**onboard**_ once, but _**continuously**_, and repeat it.

3. Do their jobs, or at least, let them _**batch**_ it.

4. Let them easily _**go back**_, to re-view. Keep their _**overview**_.

5. Always let them _**undo**_, and don't make them redo.

6. _**Cut down steps**_ to the absolute few, based on what they _**actually do**_. Don't force them to adapt to you.

7. Treat their _**input as sacred**_, so they don't lose, even a few.

8. **Spark joy**; invest in small delights, so they are repeatedly attracted to you. You see the utility and **business value** in _that_, don't you?