Rank

Rank RANK calculates the rank of a value in a group of values. The return type is NUMBER. Syntax: RANK( expression ) WITHIN GROUP ( ORDER BY expression ) RANK( ) OVER ([query_partition_clause] order_by_clause) Example 1: SELECT RANK(1000, 300) WITHIN GROUP (ORDER BY SAL, COMM) from EMP; Example 2: SELECT e.EMPNO, e.ENAME, e.DEPTNO, e.SAL, RANK()…(Continue Reading)

Dense_Rank

Dense_Rank DENSE_RANK computes the rank of a row in an ordered group of rows and returns the rank as a NUMBER. The ranks are consecutive integers beginning with 1. Syntax: DENSE_RANK( expression ) WITHIN GROUP ( ORDER BY expression ) DENSE_RANK( ) OVER ([query_partition_clause] order_by_clause) Example 1: select DENSE_RANK(1000, 300) WITHIN GROUP (ORDER BY SAL,…(Continue Reading)

Listagg

Working with Oracle SQL often means wrangling data into readable formats—especially when reporting or exporting data. One common challenge is concatenating values from multiple rows into a single string. Enter LISTAGG, Oracle’s purpose-built function for just that. What is LISTAGG? LISTAGG is an aggregate function introduced in Oracle 11g Release 2. It lets you combine…(Continue Reading)

ORA-01950 no privileges on tablespace USERS

ORA-01950: no privileges on tablespace USERS Oracle SQL Error: ORA-01950: no privileges on tablespace ‘USERS’ Cause: User does not have privileges to allocate an extent in the specified tablespace. Solution: Grant the user the appropriate system privileges or grant the user space resource on the tablespace. Example: Insert into DEPARTMENTS (DEP_ID,DEP_NAME) values (‘1′,’aaa’); Output: SQL…(Continue Reading)

ORA-01017: invalid username/password logon denied

ORA-01017: invalid username/password; logon denied Oracle SQL Error: ORA-01017: invalid username/password; logon denied Cause: An attempt was made to logon on database schema. Solution: Check if the username and password are correct. Check if the user has the right to create session. Example: CREATE USER test3 IDENTIFIED BY test_user3; GRANT create session TO test3; Output:…(Continue Reading)