invantive documentationpart of invantive cloud
Invantive Support ForumsLog In / Sign Up

BASENAME

Syntax

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> BASENAME[BASENAME]:::quoted
    BASENAME --> FUNCPARS1["("]:::quoted
    FUNCPARS1 --> FUNCPARS2[parameters]
    FUNCPARS2 --> FUNCPARS3[")"]:::quoted
    FUNCPARS3 --> End((END))

Purpose

The BASENAME SQL function extracts the file name from a file path.

Parameters:

  • File path (varchar2): full path of a file, containing filename, but also possibly drive, folders and extension.
  • Extension (optional, varchar2): extension to remove, including leading '.' when necessary.

Returns: the file name from the file path as varchar2.

Examples

The following example extracts the filename from a file name and path:

select basename('c:\temp\myfile.png')

--------------------
myfile.png

The following example extracts the filename from a file name and path, including removal of the .png extension:

select basename('c:\temp\myfile.png', '.png')

--------------------
myfile