Sign Up to our social questions and Answers to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers to ask questions, answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This promise is immense; every day and every night, we are trying our best to fulfill it by helping others, leaving something worthwhile behind us, and living for a purpose that is "Enrich & Spread knowledge everywhere".
What are the differences between SQL and PL/SQL in Oracle
SQL- SQL, is Structural Query Language for database. SQL has no variables. SQL is data oriented languages. SQL is very declarative in nature. SQL is used in manipulating data. SQL tells data what to do ? PLSQL- PL/SQL is a programming language using SQL for a database. PL/SQL has variables, data typRead more
SQL-
PLSQL-
What is the use of ADD, DROP and MODIFY Commands
ALTER TABLE is used to add, delete/drop or modify columns in the existing table. It is alsoused to add and drop various constraints on the existing table. ALTER TABLE - ADD ADD is used to add columns into the existing table. Sometimes we may require to addadditional information, in that case we do nRead more
ALTER TABLE is used to add, delete/drop or modify columns in the existing table. It is also
used to add and drop various constraints on the existing table.
ALTER TABLE – ADD
ADD is used to add columns into the existing table. Sometimes we may require to add
additional information, in that case we do not require to create the whole database
again, ADD comes to our rescue.
Syntax:
ADD (Columnname_1 datatype,
Columnname_2 datatype,
Columnname_n datatype);
ALTER TABLE – DROP
DROP COLUMN is used to drop column in a table. Deleting the unwanted columns from
the table.
Syntax:
DROP COLUMN column_name;
ALTER TABLE-MODIFY
It is used to modify the existing columns in a table. Multiple columns can also be modified
at once.
Syntax may vary slightly in different databases. Syntax(Oracle,MySQL,MariaDB):
MODIFY column_name column_type;
Syntax(SQL Server):
ALTER COLUMN column_name column_type;
Queries
Sample Table:
Student
1 Ram
2 Abhi
3 Rahul
4 Tanu
QUERY:•
To ADD 2 columns AGE and COURSE to table Student
OUTPUT:
1 Ram
2 Abhi
3 Rahul
4 Tanu
• MODIFY column COURSE in table Student
After running the above query maximum size of Course Column is reduced to 20
from 40.
ALTER TABLE Student DROP COLUMN COURSE;
ROLL_NONAMEAGE
1 Ram
2 Abhi
3 Rahul
4 Tanu
How do I get nth sting from comma delimiter string
You can use REGEXP_SUBSTR to find the nth specific string from comma delimiter string Example: SELECT REGEXP_SUBSTR ('Oraask,Google,yahoo,new,old,etc','[^,]+' , 1, 3) third_value FROM DUAL; Result: yahoo
You can use REGEXP_SUBSTR to find the nth specific string from comma delimiter string
Example:
Result:
How can we set java path in windows 10
Following are the steps for setting the java path in window 10 :- 1- Go to the Search box and type advanced system settings in it. Now click on the View advanced system settings. 2- Select the Advanced tab and then click environment variables. 3- In the system, variables click the New button. Now inRead more
Following are the steps for setting the java path in window 10 :-
1- Go to the Search box and type advanced system settings in it. Now click on the View advanced system settings.
2- Select the Advanced tab and then click environment variables.
3- In the system, variables click the New button. Now in the edit system variable, type variable name as JAVA_PATH and variable path as the path where the JDK folder is saved and click on OK button Usually the path of the JDK file will be C:\Program Files\Java\jdk1.8.0_60.
4- Now in the system variables go to the path and click the edit button.
5- Click the New button.
6- Now add the following path: %JAVA_HOME%\bin
I hope this helps.
See lessHow to check if List empty or null in C#
Check if the list is empty in C# You can check whether the list is empty or not in many ways. The first approach is to check for null, and if the count is greater than zero Example: if (strList != null && strList.Count > 0) { Console.WriteLine("The List has " + strList.Count + " reRead more
Check if the list is empty in C#
You can check whether the list is empty or not in many ways.
Example:
Output:
Example:
Output:
Do you find it helpful? Share to Spread Knowledge
See lessWhat is CTE in Oracle SQL
CTE stands for Common Table Expression. Another acronym is subquery factory; It's simply a query that you can define in another query. It starts with WITH clause that lets you assign a name to a subquery block. Then you can reference this subquery block in multiple places within your main query by gRead more
CTE stands for Common Table Expression. Another acronym is subquery factory; It’s simply a query that you can define in another query. It starts with WITH clause that lets you assign a name to a subquery block. Then you can reference this subquery block in multiple places within your main query by giving that query a name.
Oracle database traits that query name as either an inline view or as a temporary table that will be dropped automatically after the execution of your main query is finished.
Let’s take a simple example to showcase the use of CTE in the Oracle database
Let’s say we need to get the employees that are hired on the first day of each month in the current year.
Output:
| FIREST_NAME | LAST_NAME | HIRE_DATE
| ——————- | —————- | —————-|
| Samuel | McCain | 01/07/2006 |
In the above query, we first start our query with a WITH clause to define a temporary table that has a date of the first day of each month and give that temp table or inline view a name which is “hiring_period” and then uses this name in the main query by joining it with the employee’s table using the hire date column.
See lessWhy do we use bulk collect in Oracle
BULK COLLECT in Oracle PL/SQL: BULK COLLECT in Oracle PL/SQL reduces the round trip between SQL engine and PL/SQL engine and allows SQL engine to fitch a bulk collection of data at once instead of the traditional LOOP statement. We are using the BULK COLLECT clause in the SELECT statement to fitch tRead more
BULK COLLECT in Oracle PL/SQL:
BULK COLLECT in Oracle PL/SQL reduces the round trip between SQL engine and PL/SQL engine and allows SQL engine to fitch a bulk collection of data at once instead of the traditional LOOP statement.
We are using the BULK COLLECT clause in the SELECT statement to fitch the cursor result set in bulk or to populate the records in bulk.
Since the BULK COLLECT fetches a result set or more than one record, the INTO clause must contain a collection variable like Oracle TYPE.
Example:
Output :
In the above script, we used a LIMIT clause to limit fetching the bulk of records to 10 records at a time. This clause is very handful when dealing with a large number of records to avoid running out of memory because the collection type we use is expanding as more records are inserted into it.
Do you find it helpful? Share to spread the knowledge
See lessSearch all columns of the database oracle SQL
To find The tables which contain a particular column name, you can use the following query: SELECT owner, table_name, column_name FROM all_tab_columns WHERE column_name LIKE '%TRANSACTION_QUANTITY%'; The output of this select statement would be: You can get the result from a specific owner schema liRead more
To find The tables which contain a particular column name, you can use the following query:
The output of this select statement would be:
You can get the result from a specific owner schema like ‘INV’ and so on.
You may also be interested in checking my answer to other related questions from here Get Column Name from Table in Oracle
See lessHow to Print to Console in Javascript
There are various ways to to console info. Here are some important methods of console API console.log() console.log(123); //number console.log("Hello World!"); //string console.log(10 + 20); //expression console.log(new Date()); //object console.clear() console.log(10); console.log("Hello World!");Read more
There are various ways to to console info.
Here are some important methods of console API
console.log()
console.clear()
console.error()
console.assert()
console.table() :
console.time() and console.timeEnd()
How to copy a table without data in oracle?
To copy a table without copying its data, you can simply use this SQL statement: CREATE TABLE xx_oraask_tbl_bkp AS SELECT * FROM xx_oraask_tbl WHERE 1=0; But there is a limitation to using the above statement that you have to pay attention to: The following database objects are not copied to the newRead more
To copy a table without copying its data, you can simply use this SQL statement:
But there is a limitation to using the above statement that you have to pay attention to:
The following database objects are not copied to the new version of your table
Or you can use another way to do this:
In the above statement, you will get the DDL statement of a specified table, and then you can easily change the table name, the indexes, etc.
See less