SINGLE ROW FUNCTIONS 1. CHARACTER MANIPULATION Prof. Carmen Popescu Oracle Academy Lead Adjunct.

Slides:



Advertisements
Similar presentations
N.G.Acharya & D.K.Marathe college Chembur-E, Mumbai-71
Advertisements

Manipulating Strings String Functions. VB provides a large number of functions that facilitate working with strings. These are found in Microsoft.VisualBasic.Strings.
Copyright © 2007, Oracle. All rights reserved Using Single-Row Functions to Customize Output Modified: October 21, 2014.
Strings in Visual Basic Words, Phrases, and Spaces.
Introduction to Oracle9i: SQL1 Selected Single-Row Functions.
Introduction to PL/SQL
Using Single-Row Functions to Customize Output
Lecture 6 29/1/15. Number functions Number functions take numbers as input, change them, and output the results as numbers. 2.
SQL Use of Functions Character functions Please use speaker notes for additional information!
BACS 287 Visual Basic String Manipulation. BACS 287 Visual Basic Strings In Visual Basic, a “string” is a series of text, numbers, and special characters.
Ch. 3 Single-Row Functions Important Legal Notice:  Materials on this lecture are from a book titled “Oracle Education” by Kochhar, Gravina, and Nathan.
EXCEL FUNCTIONS MIS THE BASICS  LEFT(), RIGHT(), MID()  Keep X characters from string  CONCATENATE()  Join two strings together  TRIM()  Drop.
Oracle FUNCTIONS. Comment ScreenShot (in 10g) General Example of null Foreign Key: create table deptcs( deptno NUMBER(4) primary key, hiredate DATE,
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 9 More About Strings.
Number Functions. 2 home back first prev next last Review single-row character functions –character case-manipulation functions  LOWER, UPPER, INITCAP.
Manipulation Masterclass By the VB Gods. In this masterclass, we will learn how to use some of the string manipulation function such as Len, Right, Left,
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL.
Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character.
Functions Oracle Labs 5 & 6. 2/3/2005Adapted from Introduction to Oracle: SQL and PL/SQL 2 SQL Functions Function arg n arg 2 arg 1. Input Resulting Value.
Manipulating Text In today’s lesson we will look at: why we might want to pick out parts of text strings some BASIC functions that can be used to chop.
3 Copyright © 2004, Oracle. All rights reserved. Using Single-Row Functions to Customize Output.
Single – Row Functions. Objectives After completing this lesson, you should be able to do the following:  Describe various types of functions available.
Single Row Functions Week 2. Objectives –Describe types of single row functions in SQL –Describe and use character, number, date, general and conversion.
Oracle 11g: SQL Chapter 10 Selected Single-Row Functions.
LECTURE 1 INTRODUCTION TO PL/SQL Tasneem Ghnaimat.
SQL Oracle PL/SQL. Select SELECT column1, column2,...columnN FROM table_name WHERE condition; SELECT column1, column2,...columnN FROM table_name WHERE.
Manipulating Strings. What is a string? Data composed of text characters. The data is stored in consecutive bytes of memory. Each byte stores the ASCII.
Chapter 3 Selected Single-Row Functions and Advanced DML & DDL.
Instructor: Craig Duckett Lecture 08: Thursday, October 22 nd, 2015 Patterns, Order of Evaluation, Concatenation, Substrings, Trim, Position 1 BIT275:
EXPRESSION Transformation. Introduction ►Transformations help to transform the source data according to the requirements of target system and it ensures.
IFS Intro to Data Management Chapter 5 Getting More Than Simple Columns.
Single Row Functions. Objectives –Use character, number, and date functions –Use conversion functions –Describe types of single row functions in SQL.
3 Copyright © 2009, Oracle. All rights reserved. Using Single-Row Functions to Customize Output.
SQL Functions. SQL functions are built into Oracle Database and are available for use in various appropriate SQL statements. These functions are use full.
H2K Infosys is business based in Atlanta, Georgia – United States Providing Online IT training services world wide. USA - +1-(770) ,
1 Session 6: Database Best Practice iNET Academy Open Source Web Development.
Built-in SQL Functions. 2 Type of Functions Character Functions returning character values returning numeric values Numeric Functions Date Functions Conversion.
CECS 5020 Computers in Education Visual Basic Variables and Constants.
INSS 6511 Lecture 5 SQL Continued. INSS 6512 SUBQUERIES. Queries inside query There are times when you need information from a table to answer query related.
1 CSE 2337 Chapter 7 Organizing Data. 2 Overview Import unstructured data Concatenation Parse Create Excel Lists.
4/2/16. Ltrim() is used to remove leading occurrences of characters. If we don’t specify a character, Oracle will remove leading spaces. For example Running.
1 Inside Module 8 Extracting Data Page n Using the Extract command2 n Coercion3 n $-functions4 n Extract from a table7.
[ ] Square brackets enclose syntax options { } Braces enclose items of which only one is required | A vertical bar denotes options … Three dots indicate.
Strings PART I STRINGS, DATES, AND TIMES. FUNDAMENTALS OF CHARATERS AND STRINGS VB represents characters using American National Standards Institute(ANSI)
Gollis University Faculty of Computer Engineering Chapter Five: Retrieval, Functions Instructor: Mukhtar M Ali “Hakaale” BCS.
CSC 162 Visual Basic I Programming. String Functions LTrim( string ) –Removes leading spaces from the left side of string RTrim( string ) –Removes trailing.
3 Copyright © 2009, Oracle. All rights reserved. Using Single-Row Functions to Customize Output.
13/06/ Strings Left, Right and Trim. 213/06/2016 Learning Objectives Explain what the Left, Right and Trim functions do.
Defining a Column Alias
Copyright  Oracle Corporation, All rights reserved. 3 Single-Row Functions.
Single Row Functions Part I Week 2. Objectives –Describe types of single row functions in SQL –Describe and use character, number and date SQL functions.
Open Source Server Side Scripting MySQL Functions
Computer Programming ||
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL
SQL 101 3rd Session.
SQL Text Manipulation Farrokh Alemi, Ph.D.
دوال حرفية دوال رقميه دوال تاريخ دوال تحويل
SQL 101 2nd Session.
VBScript Session 10.
Basic String Operations
Microsoft Visual Basic 2005: Reloaded Second Edition
Topics Basic String Operations String Slicing
String Processing 1 MIS 3406 Department of MIS Fox School of Business
MapInfo SQL String Functions
Topics Basic String Operations String Slicing
Topics Basic String Operations String Slicing
Introduction to SQL Server and the Structure Query Language
Murach's JavaScript and jQuery (3rd Ed.)
Oracle Academy Lead Adjunct
Presentation transcript:

SINGLE ROW FUNCTIONS 1. CHARACTER MANIPULATION Prof. Carmen Popescu Oracle Academy Lead Adjunct

Concatenation  str1 || str2  CONCAT(str1,str2)  To concatenate more that 2 strings: Str1 || str2 || str4 CONCAT(str1,CONCAT(str2,str3))

RPAD, LPAD  RPAD(string,length,['set'])  LPAD(string,length,['set']) If 'set' does not appear the string will be padded with spaces.

RPAD, LPAD Examples SELECT RPAD('ab',10,'<>') FROM DUAL => ab<><><><> SELECT LPAD('xyz',15,'*') FROM DUAL  ************xyz

RPAD, LPAD Examples SELECT LPAD(RPAD('abc',8,'='),13,'=') FROM DUAL => =====abc===== SELECT LPAD(RPAD('abc',8,'='),13,'=') FROM DUAL => =====abc===== SELECT LPAD(RPAD('abc',8,'='),13,'=') FROM DUAL => =====abc=====

LTRIM, RTRIM  Trim off unwanted characters from the left (LTRIM), right (RTRIM) LTRIM(string,[’set’]) Set is the collection of characters you want to trim off. If no set is specified, the function trim off spaces.

LTRIM, RTRIM Examples SELECT LTRIM('**==**abc**==**','*') FROM DUAL => ==**abc**==** SELECT RTRIM('**==**abc**==**','*') FROM DUAL => **==**abc**==

TRIM  trim ( [leading|trailing|both ['set'] FROM] s1)  Trim off set from the beginning, the end or both of the string s1  both option is Implicit  If no set is specified, the function trim off spaces.

TRIM Examples SELECT TRIM(leading 'ab' from 'ababbabbabab') FROM DUAL => babababab

TRIM Examples SELECT TRIM(trailing 'ab' from 'ababbabbabab') FROM DUAL => ababbabb

TRIM Examples SELECT TRIM('ab' from 'ababbabbabab') FROM DUAL => babb

LOWER, UPPER, INITCAP  UPPER(string)  LOWER(string)  INITCAP(string)

LOWER, UPPER, INITCAP SELECT UPPER('aBcD'), LOWER('aBcD'), INITCAP('aBcD') FROM DUAL SELECT UPPER('aBcD'), LOWER('aBcD'), INITCAP('aBcD') FROM DUAL => ABCD SELECT UPPER('aBcD'), LOWER('aBcD'), INITCAP('aBcD') FROM DUAL => ABCDabcd SELECT UPPER('aBcD'), LOWER('aBcD'), INITCAP('aBcD') FROM DUAL => ABCDabcdAbcd

LENGTH SELECT LENGTH('abc') FROM DUAL => 3

SUBSTR SUBSTR(string,start[,count]) - If no count is specified, the function return the substring starting at position start and going to the end of the string. SELECT SUBSTR('abcdefghi',5,2) FROM DUAL  ef SELECT SUBSTR('abcdefghi',5) FROM DUAL  efghi

INSTR INSTR(string,substring[,start[,n]])  Search for the n-th occurrence of the substring in the string, starting with the start position  If the start position is not mention the function will look for the substring starting at position 1.  If n is not mention the function will look for the first occurrence of the substring in the string

INSTR examples SELECT INSTR('xyzabcxabcxabcxyz','abc') from dual  4 SELECT INSTR('xyzabcxabcxabcxyz','abc',6) from dual  8 SELECT INSTR('xyzabcxabcxabcxyz','abc',1,2) from dual  8 SELECT INSTR('xyzabcxabcxabcxyz','abc',5,2) from dual  12

SUBSTR, INSTR Together SELECT Author, SUBSTR(Author, INSTR(Author,',')+2 ) || ' ' || SUBSTR(Author,1, INSTR(Author,',')-1 ) FROM Magazine Results: Eminescu, MihaiMihai Eminescu Creanga, IonIon Creanga Cosbuc, GeorgeGeorge Cosbuc