Count number of Characters in CLOB field
580471May 31 2007 — edited May 31 2007Hi all,
I posted this on another database, but I think it really belongs here. I have a CLOB field that stores reports in HTML markup languate. Here's an example of a report.
<br><br></title> </head> <body contenteditable="true" text="#000000" bgcolor="#ffffff"> this is a test for a bilateral modifier </body> </html><br><br>
I'm trying to provide a query that counts the number of characters that is not a HTML tag nor whitespace. I've attempted to use a combination of the length and replace function which first replace all HTML tags and whitespaces with nothing and then uses length to calculate the number of characters. Here's what the function looks like.
<br><br>length(trim (both ' ' from replace (replace (replace(replace (replace(replace(replace(replace (replace(replace(replace (replace(replace (replace(reports.report_text ,'</head>',''),'</title>',''),'<body contenteditable="true" text="#000000" bgcolor="#ffffff">',''),'</body>',''),'</html>',''),'',''),'',''),'',''),'',''),'',''),'',''),'',''),'',''),'>','')))
<br><br>
For the example above, the number of characters counted in the outputs is 66, which is clearly incorrect. I need to only count these characters for the example above "thisisatestforabilateralmodifier", but there is still white space that remains after I do the sequence of replaces. If someone can help, it's be greatly appreciated. Thanks.
Message was edited by:
user577468