Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8941383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:17:11+00:00 2026-06-15T11:17:11+00:00

I’m doing text mining using Oracle SQL Developer: ODMiner.. I imported the data WEBLOG

  • 0

I’m doing text mining using Oracle SQL Developer: ODMiner.. I imported the data “WEBLOG” into a table.. This weblog data consist of users activity, date, time, url, etc. The first step I took was to use a function to transform date and time that I have in the data table, into a number representing the 40 mins since 01-01-1990. I did this by dividing it by 2400 (seconds in 40 mins). The main purpose is to have a time frame for the sessions.
I used the following code,

    CREATE OR REPLACE FUNCTION ssnDate(
    DATE IN VARCHAR2 DEFAULT 03-01-18,
    TIME IN VARCHAR2
    ) RETURN NUMBER
    AS
    BEGIN
       RETURN TRUNC((to_date(DATE||' '||TIME, 'DD-MM-YY HH:MM:SS')- to_date('01-JAN-    1990','DD-MON-YYYY')) * (86400/2400);
    END ssnDate;

This was what appeared in the log after running the statement,

FUNCTION ssnDate compiled
Warning: execution completed with warning

After this, I tried to create a VIEW to transform the DATE and TIME with the ssnDate that was created earlier on, and concatenate the CS_URI_STEM (which is the resource accessed), and CS_URI_QUERY (which is the the query, if any, the client was trying to perform)into a new field called WEB_LINK.

This is the code used,

    CREATE OR REPLACE VIEW WEBLOG_VIEWS("C_IP", "WEB_LINK", "CS_USER_AGENT", "SESSION")
    AS
    SELECT ssnDate(LOG_DATE, LOG_TIME) AS 'SESSION',
    C_IP,
    CS_USER_AGENT,
    (CS_URI_STEM||'?'||CS_URI_QUERY) AS WEB_LINK
    FROM WEBLOG;

Now from this I got the following error..

Error starting at line 1 in command:
CREATE OR REPLACE VIEW WEBLOG_VIEWS("C_IP", "WEB_LINK", "CS_USER_AGENT", "SESSION")
AS
SELECT ssnDate(LOG_DATE, LOG_TIME) AS 'SESSION',
C_IP,
CS_USER_AGENT,
(CS_URI_STEM||'?'||CS_URI_QUERY) AS WEB_LINK
FROM WEBLOG
Error at Command Line:3 Column:38
Error report:
SQL Error: ORA-00923: FROM keyword not found where expected
00923. 00000 - "FROM keyword not found where expected"
*Cause: 
*Action:

I don’t get where I’m going wrong with this.. This is the data preparation stage which requires me to prep the data before applying modeling techniques or algorithms.. The next step would be grouping the data, based on the session time, ip and the user agent of each session along with the web_links fields visited by the user in that session.

I would really be grateful for any inputs on where I’m going wrong or for any kind of solutions!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:17:12+00:00Added an answer on June 15, 2026 at 11:17 am

    you have numerous errors and inefficiencies in this small snippet of code.

    firstly,

    P_DATE IN VARCHAR2 DEFAULT 03-01-18
    

    this default is nonsense. you’re actually saying the default is minus 16 (3 minus 1 minnus 18!). it should be in single quotes

    P_DATE IN VARCHAR2 DEFAULT '03-01-18'
    

    Secondly, if the function is that simple, I would recommend you just put

    TRUNC((to_date(DATE||' '||TIME, 'DD-MM-YY HH:MM:SS')- to_date('01-JAN-1990','DD-MON-YYYY')) * (86400/2400))
    

    into the view itself to avoid the context (SQL->PLSQL) switching for every row returned. If you want to keep it as a function, then read up on scalar subquery caching. i.e. use the deterministic function (or in 11g go for result_cache) and put the function in a sub query too.

    thirdly, your view definition columns don’t line up with the actual columns used.

    CREATE OR REPLACE VIEW WEBLOG_VIEWS("C_IP", "WEB_LINK", 
      "CS_USER_AGENT", "SESSION")
        AS
        SELECT ssnDate(LOG_DATE, LOG_TIME) AS 'SESSION',
        C_IP,
        CS_USER_AGENT,
        (CS_URI_STEM||'?'||CS_URI_QUERY) AS WEB_LINK
    

    so C_IP is really “SESSION”, WEB_LINK is really C_IP etc.

    also don’t use SQL reserved words (SESSION) in tables/views. you’re just making a rod for your own back, as every time you select against this view, you need to type “SESSION” with quotes instead of just session.

    finally, why are you storing a date and time as CHAR data instead of a native DATE? if you can change that, it will be much better in the long run. especially as you are storing dates using YY format which is an even worse sin than storing as YYYY!

    so all that being said, if you want to keep the function, change it to something like this:

    create or replace function ssndate(p_date in varchar2 default '03-01-18',
                                       p_time in varchar2)
    return number
    $if dbms_db_version.ver_le_10 $then
    deterministic
    $elsif dbms_db_version.ver_le_11 $then
    result_cache
    $end
    as
    begin
      return trunc((to_date(p_date||' '||p_time, 'dd-mm-yy hh24:mi:ss')
              - to_date('01-jan-1990','dd-mon-yyyy')) * (86400/2400));
    end ssndate;
    /
    

    that $ code will just put RESULT_CACHE if you’re on 11g and DETERMINISTIC otherwise.

    and the view should contain this function as a subquery instead:

    create or replace view weblog_views
    as
    select (select ssndate(log_date, log_time) from dual) as "SESSION",
           c_ip,
           cs_user_agent,
           (cs_uri_stem||'?'||cs_uri_query) as web_link
      from weblog;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the
I am currently running into a problem where an element is coming back from
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.