union vs union all in sql

union vs union all in sql oracle

The UNION operator is a set operator that combines result sets of two or more SELECT statements into a single result set.
There is a performance hit when using UNION instead of UNION ALL, since the database server must do additional work to remove the duplicate rows, but usually you do not want the duplicates (especially when developing reports).
To identify duplicates, records must be comparable types as well as compatible types. This will depend on the SQL system. For example the system may truncate all long text fields to make short text fields for comparison (MS Jet), or may refuse to compare binary fields (ORACLE)

UNION statement

The following illustrates the syntax of the UNION operator that combines the result sets of two queries:

In this statement, the name1 , mame2 and name3 must have the same number of columns presented in the same order. In addition, the data type of the corresponding column must be in the same data type group such as number or character.

UNION example

Result union statment

nametest

UNION ALL statement

UNION ALL example

Result union all statment

nametest
nametest
nametester

 

 

Reference :

Oracle UNION


https://stackoverflow.com/questions/49925/what-is-the-difference-between-union-and-union-all

sql exec stored procedure

oracle sql exec stored procedure

This syntax sql for execute store procedure in oracle

Procedure Name: JS_WS_GET_ABS_TYPE

How to execute prodecure and print output in sql

Syntax sql for select store procedure in oracle

 

alter table

The oracle alter table statement by pl sql is used to add column, modify, or drop/delete columns in a table. The oracle alter table statement is also used to rename a table.

alter table to add column in table oracle

Syntax

how to use pl sql alter table to add column in table, the oracle alter table syatnx is:

Example 1:

alter table PS_JS_EX_PART2 add COMPANY_DESCR VARCHAR2(30 CHAR);
/
alter table PS_JS_EX_PART2 add KTB_TAX_ID VARCHAR2(15 CHAR);
/

Example 2:

 add multiple columns in table

Syntax

In this syntax, you separate two columns by a comma

Example 3:

Modify column in table

Syntax

Example 4:

Modify Multiple columns in table

Syntax

Example 5:

Drop column in table

Syntax

Example 6:

Rename column in table (NEW in Oracle 9i Release 2)

Syntax

Example 7:

Rename table

Syntax

Example 8:

SQL UPDATE

SQL UPDATE Statement

This staement of update by Sql

Sql update where

Syntax: UPDATE Table Set fied1= Value1 , field2= Value2, … WHERE Emplid =’Test’;

UPDATE table_name
SET column1 = value1, column2 = value2, …
WHERE condition;

For Example:

Update Table Set Name=’Dakdee’ Where Emplid =’TT005′;

Update Table Set Name=’Dakdee’, LastName=’Toodd’ Where Emplid =’TT005′;

Sql update from select

Update TableName a  set(a.column1, a.column2,a…) = (select column1, column2,… from tablename b where b.key = a.key) where exists (select ‘X’ from tablename b where b.key = a.key)

Sql update with join

Example 1

UPDATE tablename1
INNER JOIN tablename2 ON tablename1.value = tablename2.DESCR
SET tablename1.value = tablename2.IDKEY
WHERE tablename1.IDCODE=’XX’;

Example 2

UPDATE Person
SET
Person.PersonCityName=Address.City,
Person.PersonPostCode=Addrrss.PostCode
FROM Persons Person
INNER JOIN
Address Addrress
ON Person.Id = Addrrss.Id

If you want update muticolumn by sql then read more update select sql example.

how to create trigger in sql

 create trigger sql

How to CREATE TRIGGER statement allows you to create a new trigger that is fired automatically whenever an event such as INSERT, DELETE, or UPDATE occurs against a table.

CREATE TRIGGER syntax

CREATE TRIGGER [schema_name.]trigger_name

ON table_name

AFTER {[INSERT],[UPDATE],[DELETE]} [NOT FOR REPLICATION]

AS {sql_statements}

Example trigger for oracle peoplesoft

How to find blank/ tab character string oracle sql

How to find blank/ tab character string oracle SQL

How to find blank/ tab character string oracle SQL

How to replace Line Feeds, Carriage Returns and tabs are the usual culprits and cannot be removed using the standard orLTrimRTrim Functions. You can remove them with the following:

LTRIM(RTRIM(REPLACE(REPLACE(REPLACE(StringCharacter, CHAR(10), ''), CHAR(13), ''), CHAR(9), '')))

If you encounter more white space characters that can’t be removed with the above then try one or all of the following:

 

References:
http://pplsoftlearner.blogspot.com/2016/
http://psacake.com/web/kn.asp

oracle sql case

oracle sql case

oracle sql case or case statement in sql

 

How to find PeopleSoft Project Item List SQL

How to find PeopleSoft Project Item List SQL

How to find PeopleSoft Project Item List SQL in table PSPROJECTITEM.

This SQL for select all list your project in application designer (AE) such as sql table, sql view table, work record, sub record, dynamic view, query view, temp table, other record or deleted, index, field, page, menu, component.

SQL help you run a sql query to list all the objects in a project in application designer.

 

Reference: http://peoplesofttutorial.com/sql-to-list-project-items-in-peoplesoft/

How to Make a Private PeopleSoft Query to Public using Update SQL

How to Make a Private PeopleSoft Query to Public using Update SQL

How to Make a Private PeopleSoft Query to Public using Update SQL. You can update Oprid is blank of all record relation

UPDATE PSQRYBIND SET OPRID = ‘ ‘WHERE OPRID = ‘OLD_USER’ AND QRYNAME = ‘NEW_USER’;
UPDATE PSQRYBINDLANG SET OPRID = ‘ ‘WHERE OPRID = ‘OLD_USER’ AND QRYNAME = ‘NEW_USER’;
UPDATE PSQRYCRITERIA SET OPRID = ‘ ‘WHERE OPRID = ‘OLD_USER’ AND QRYNAME = ‘NEW_USER’;
UPDATE PSQRYDEFN SET OPRID = ‘ ‘WHERE OPRID = ‘OLD_USER’ AND QRYNAME = ‘NEW_USER’;
UPDATE PSQRYDEFNLANG SET OPRID = ‘ ‘WHERE OPRID = ‘OLD_USER’ AND QRYNAME = ‘NEW_USER’;
UPDATE PSQRYEXPR SET OPRID = ‘ ‘WHERE OPRID = ‘OLD_USER’ AND QRYNAME = ‘NEW_USER’;
UPDATE PSQRYFIELD SET OPRID = ‘ ‘WHERE OPRID = ‘OLD_USER’ AND QRYNAME = ‘NEW_USER’;
UPDATE PSQRYFIELDLANG SET OPRID = ‘ ‘WHERE OPRID = ‘OLD_USER’ AND QRYNAME = ‘NEW_USER’;
UPDATE PSQRYRECORD SET OPRID = ‘ ‘WHERE OPRID = ‘OLD_USER’ AND QRYNAME = ‘NEW_USER’;
UPDATE PSQRYSELECT SET OPRID = ‘ ‘WHERE OPRID = ‘OLD_USER’ AND QRYNAME = ‘NEW_USER’;

More suggestion:
– You Create a PUBLIC ps query by clone of the PRIVATE ps query
– Rename ps query from PRIVATE or PUBLIC query
– Delete a query

 

Reference:https://hexaware.com/blogs/how-to-make-a-peoplesoft-private-query-public/