There is a Documents table with a DOC_FNAME field in which the full names of documents with their type are stored.
For example:
+---------------+ |abrahadabra.pdf| |---------------| |some.txt | |---------------| |Doc.docx | +---------------+ You need a query to get the document type so that it is:
+------+ |.pdf | |------| |.txt | |------| |.docx | +------+ I try this:
SELECT ( SELECT (substr( d.DOC_FNAME, length(d.DOC_FNAME) - instr('.', d.DOC_FNAME)+1)) FROM dual) AS doctype FROM Documents d GROUP BY d.DOC_FNAME; but I do not get the desired result. Please help.
( SELECT (substr( d.DOC_FNAME, length(d.DOC_FNAME) - instr('.', d.DOC_FNAME)+1)) FROM dual)just the conditionsubstr(d.DOC_FNAME, instr('.', d.DOC_FNAME))- Chubatiysubstr(d.DOC_FNAME, instr(d.DOC_FNAME, '.'))- Chubatiy