How to convert system Date into DD-MMM-YYYY Format

hi friends,
please help me How to convert system Date into DD-MMM-YYYY Format.
Regards
Yogesh

HI..
data: w_dt(11) type c,
         w_month(2),
         w_mon(3).
w_month = p_date+4(2). **p_date = given date**
case w_month.
when '01'.
w_mon = 'Jan'.
when '02'.
w_mon = 'Feb'.
when '03'.
w_mon = 'Mar'.
when '04'.
w_mon = 'Apr'.
when '05'.
w_mon = 'May'.
when '06'.
w_mon = 'Jun'.
when '07'.
w_mon = 'Jul'.
when '08'.
w_mon = 'Aug'.
when '09'.
w_mon = 'Sep'.
when '10'.
w_mon = 'Oct'.
when '11'.
w_mon = 'Nov'.
when '12'.
w_mon = 'Dec'.
endcase.
Now...
  concatenate p_date6(2)  '-'  w_mon  '-'   p_date0(4)  into w_dt.
write w_dt.

Similar Messages

  • Convert system date into mm-dd-yyyy format

    Hi everyone, I am developing an web application in jsp.In my application when a client enters his information like name,email etc, they are copied into the database.What i need now is at the same time the system date also has to enter into the database in the format mm-dd-yyyy.My application doesn't ask the user to enter the particular date.So immediately after the client clicks the save button along with the information he saved the system date also has to enter into his particular database. Can anyone help me how to program this or give an idea regarding the approach to be followed. Any sample code is highly appreciated.Thanks in advance,

    well, your application collects user entered info at some place (either in a jsp or a servlet or a handler). At this point you have to generate the sysdate in the specified format.
    For example, if its a servlet that collects the user info,
    public void doGet(.........){
       //collect all request parameters
       //code from previous post to generate date in specific format
       //call method to insert all data
    }You will have to import the library classes as shown below in your program.
    import java.util.Calendar;
    import java.util.Date;
    import java.text.SimpleDateFormat;cheers,
    ram.
    PS: Also when your sql statement should use some kind of functions to convert the String to a date value for insertion.
    For example, in Oracle, you would do this,
    insert into test values(to_date('08-24-2005','mm-dd-yyyy'));Here test is a table with one date column.
    The to_date() function converts the string, which is the first argument, to a date and conversion pattern is the second argument.
    Unfortunately I cant help you with this because Iam not so familiar with mysql.
    cheers,
    ram.

  • How to store xml data into file in xml format through java program?

    HI Friends,
    Please let me know
    How to store xml data into file in xml format through java program?
    thanks......
    can discuss further at messenger.....
    Avanish Kumar Singh
    Software Engineer,
    Samsung India Development Center,
    Bangalore--560001.
    [email protected]

    Hi i need to write the data from an XML file to a Microsoft SQL SErver database!
    i got a piece of code from the net which allows me to parse th file:
    import java.io.IOException;
    import org.xml.sax.*;
    import org.xml.sax.helpers.*;
    import org.apache.xerces.parsers.SAXParser;
    import java.lang.*;
    public class MySaxParser extends DefaultHandler
    private static int INDENT = 4;
    private static String attList = "";
    public static void main(String[] argv)
    if (argv.length != 1)
    System.out.println("Usage: java MySaxParser [URI]");
    System.exit(0);
    String uri = argv[0];
    try
    XMLReader parser = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
    MySaxParser MySaxParserInstance = new MySaxParser();
    parser.setContentHandler(MySaxParserInstance);
    parser.parse(uri);
    catch(IOException ioe)
    ioe.printStackTrace();
    catch(SAXException saxe)
    saxe.printStackTrace();
    private int idx = 0;
    public void characters(char[] ch, int start, int length)
    throws SAXException
    String s = new String(ch, start, length);
    if (ch[0] == '\n')
    return;
    System.out.println(getIndent() + " Value: " + s);
    public void endDocument() throws SAXException
    idx -= INDENT;
    public void endElement(String uri, String localName, String qName) throws SAXException
    if (!attList.equals(""))
    System.out.println(getIndent() + " Attributes: " + attList);
    attList = "";
    System.out.println(getIndent() + "end document");
    idx -= INDENT;
    public void startDocument() throws SAXException
    idx += INDENT;
    public void startElement(String uri,
    String localName,
    String qName,
    Attributes attributes) throws SAXException
    idx += INDENT;
    System.out.println('\n' + getIndent() + "start element: " + localName);
    if (localName.compareTo("Machine") == 0)
    System.out.println("YES");
    if (attributes.getLength() > 0)
    idx += INDENT;
    for (int i = 0; i < attributes.getLength(); i++)
    attList = attList + attributes.getLocalName(i) + " = " + attributes.getValue(i);
    if (i < (attributes.getLength() - 1))
    attList = attList + ", ";
    idx-= INDENT;
    private String getIndent()
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < idx; i++)
    sb.append(" ");
    return sb.toString();
    }// END PRGM
    Now , am not a very good Java DEv. and i need to find a soln. to this prob within 1 week.
    The next step is to write the data to the DB.
    Am sending an example of my file:
    <Start>
    <Machine>
    <Hostname> IPCServer </Hostname>
    <HostID> 80c04499 </HostID>
    <MachineType> sun4u [ID 466748 kern.info] Sun Ultra 5/10 UPA/PCI (UltraSPARC-IIi 360MHz) </MachineType>
    <CPU> UltraSPARC-IIi at 360 MHz </CPU>
    <Memory> RAM : 512 MB </Memory>
    <HostAdapter>
    <HA> kern.info] </HA>
    </HostAdapter>
    <Harddisks>
    <HD>
    <HD1> c0t0d0 ctrl kern.info] target 0 lun 0 </HD1>
    <HD2> ST38420A 8.2 GB </HD2>
    </HD>
    </Harddisks>
    <GraphicCard> m64B : PCI PGX 8-bit +Accel. </GraphicCard>
    <NetworkType> hme0 : Fast-Ethernet </NetworkType>
    <EthernetAddress> 09:00:30:C1:34:90 </EthernetAddress>
    <IPAddress> 149.51.23.140 </IPAddress>
    </Machine>
    </Start>
    Note that i can have more than 1 machines (meaning that i have to loop thru the file to be able to write to the DB)
    Cal u tellme what to do!
    Even better- do u have a piece of code that will help me understand and implement the database writing portion?
    I badly need help here.
    THANX

  • How to convert date  into dd mon yyyy format

    hi all,
    i have a problem in date format i am using date like below .
    <%java.util.Date date = new java.util.Date();%>
    i am inserting date into a table and its storing like this
    insert into tablename (d_date) values (date)
    and its inserting date like below
    Sun Oct 19 09:05:45 GMT+03:00 2003
    i want to fetch date in dd mon yyyy format.
    with this format i want to make a select query.i struck with the format conversion.
    how to do this.
    any comments please.
    any help

    hi all,
    i understand now where i am wrong.
    the below code is not working why because in my server where i am executing code the regional setting month value is in arabic.
    i executed the same code in a different server where date and time jones are english its working fine.
    All the problem is in regional setting and not the jsp code.
    <%
    String whtEverDateFormatYouWAnt = "dd MMM yy";
    String str = new SimpleDateFormat(whtEverDateFormatYouWAnt).format(new SimpleDateFormat("EEE MMM dd HH:mm:ss vvv yyyy").parse("Sun Oct 19 09:05:45 GMT+03:00 2003"));
    out.print(str);
    %>
    Thanks a lot for the excellent solution.
    Thanks again.

  • How to convert BLOB data into string format.

    Hi,
    I have problem while converting blob data into string format.
    for example,
    Select dbms_lob.substr(c.shape.Get_wkb(),4000,1) from geotable c
    will get me the first 4000 byte of BLOB .
    When i using SQL as i did above,the max length is 4000, but i can get 32K using plsql as below:
    declare
    my_var CLOB;
    BEGIN
    for x in (Select X from T)
    loop
    my_var:=dbms_lob.substr(x.X,32767,1)
    end loop
    return my_var;
    I comfortably convert 32k BLOB field to string.
    My problem is how to convert blob to varchar having size more than 32K.
    Please help me to resolve this,
    Thanx in advance for the support,
    Nilesh

    Nilesh,
    . . . .The result of get_wkb() will not be human readable (all values are encoded into some binary format).
    SELECT utl_raw.cast_to_varchar2(tbl.geometry.get_wkt()) from FeatureTable tbl;
    -- resulting string:
        ☺AW(⌂özßHAA
    Å\(÷. . . .You may also want to have a look at { dbms_lob | http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_lob.htm#i1015792 } "The DBMS_LOB package provides subprograms to operate on BLOBs, CLOBs, NCLOBs, BFILEs, and temporary LOBs."
    Regards,
    Noel

  • How to convert julian Date into Calendar Date

    Hi,
    I want convert julian Date to calendar Date (mm/dd/yyyy or mm/dd/yy format) in java.
    Can any one help me how to convert julian date to calendar Date.
    Thanks,
    Krishore.

    import java.util.*;
    import java.text.*;
    public class jdate {
    Calendar date;
    public jdate(int j)
    date = Calendar.getInstance();
    date.set(Calendar.DAY_OF_YEAR, j);
    public String toString()
    SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
    return (formatter.format( date.getTime() ));
    public static void main(String args[])
    if(args.length == 1)
    int j = Integer.parseInt(args[0]);
    jdate julian = new jdate(j);
    System.out.println("Julian date(" + j + ") = " + julian.toString());
    }

  • Insertion of date in dd-mmm-yyyy format

    I have a jsp page, from that i can enter values in oracle database.
    my jsp page is working, but the problem is that it can only accept the date
    dd-mmm-yyyy format. i.e 20-jun-2004, but when i enter date in dd/mm/yyyy format i.e 20/06/2004, it does not accept.
    i want to enter to do enter date in dd/mm/yyyy format in the form, and it can save the date field in database in dd-mmm-yyyy format.
    my code is as bellow:
    <html>
    <body>
    <table>
    <tr>
    <td>
    <%@ page import =" java.sql.Date.*" %>
    <%@ page import =" java.text.SimpleDateFormat.*" %>
    <%@ page import =" java.util.Date.*" %>
    <%@ page import =" java.text.*" %>
    <%@ page import="javax.servlet.*" %>
    <%@ page import="javax.servlet.http.*" %>
    <%@ page language="java" import="java.sql.*" %>
    <%
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn=DriverManager.getConnection("jdbc:odbc:pf","scott","ttlscott");
    System.out.println("got connection");
    %>
    <%
    char pay_post,pay_type;
    String action = request.getParameter("action");
    if (action != null && action.equals("save")) {
    conn.setAutoCommit(false);
    PreparedStatement pstmt = conn.prepareStatement(
    ("INSERT INTO pay_header VALUES (?, ?, ?, ?, ?, ?,?,?)"));
    pstmt.setString(1,request.getParameter("vou_no"));
    pstmt.setString(2,request.getParameter("pay_date"));
    pstmt.setString(3,request.getParameter("pay_post"));
    pstmt.setString(4,request.getParameter("pay_narr"));
    pstmt.setString(5, request.getParameter("chq_no"));
    pstmt.setString(6,request.getParameter("chq_date"));
    pstmt.setFloat(7,Float.parseFloat(request.getParameter("chq_amt")));
    pstmt.setString(8,request.getParameter("pay_type"));
    pstmt.executeUpdate();
    conn.commit();
    conn.setAutoCommit(true);
    %>
    <%
    Statement statement = conn.createStatement();
    ResultSet rs = statement.executeQuery
    ("SELECT * FROM pay_header ");
    %>
    <tr>
    <form action="payment_save1.jsp" method="get">
    <input type="hidden" value="save" name="action">
    <th><input value="" name="vou_no" size="10"></th>
    <th><input value="" name="pay_date" size="10"></th>
    <th><input value="" name="pay_post" size="15"></th>
    <th><input value="" name="pay_narr" size="15"></th>
    <th><input value="" name="chq_no" size="15"></th>
    <th><input value="" name="chq_date" size="15"></th>
    <th><input value="" name="chq_amt" size="15"></th>]
    <th><input value="" name="pay_type" size="15"></th>
    <th><input type="submit" value="save"></th>
    </form>
    </tr>
    <%
    while ( rs.next() ) {
    %>
    <tr>
    <form action="payment_save1.jsp" method="get">
    <input type="hidden" value="save" name="action">
    <td><input value="<%= rs.getString("vou_no") %>" name="vou_no"></td>
    <td><input value="<%= rs.getDate("pay_date") %>" name="gl_descr"></td>
    <td><input value="<%= rs.getString("pay_post") %>" name="pay_post"></td>
    <td><input value="<%= rs.getString("pay_narr") %>" name="pay_narr"></td>
    <td><input value="<%= rs.getString("chq_no") %>" name="chq_no"></td>
    <td><input value="<%= rs.getDate("chq_date") %>" name="chq_date"></td>
    <td><input value="<%= rs.getFloat("chq_amt") %>" name="chq_amt"></td>
    <td><input value="<%= rs.getString("pay_type") %>" name="pay_type"></td>
    <td><input type="submit" value="save"></td>
    </form>
    </tr>
    <%
    %>
    </table>
    <%
    // Close the ResultSet
    rs.close();
    // Close the Statement
    statement.close();
    // Close the Connection
    conn.close();
    } catch (SQLException sqle) {
    out.println(sqle.getMessage());
    } catch (Exception e) {
    out.println(e.getMessage());
    %>
    </td>
    </tr>
    </body>
    </html>

    thanx for u r help..
    now i have used simple date format method and also apllied setDate() method.
    bit its coming error NULL
    code:
    SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yyyy");
    java.util.Date pay_date_temp = null;
    java.util.Date pay_post_temp = null;
    PreparedStatement pstmt = conn.prepareStatement(
    ("INSERT INTO pay_header VALUES (?, ?, ?, ?, ?, ?,?,?)"));
    java.sql.Date pay_date = new java.sql.Date(pay_date_temp.getTime());
    java.sql.Date chq_date = new java.sql.Date(pay_post_temp.getTime());
    pstmt.setString(1,request.getParameter("vou_no"));
    pstmt.setDate(2,pay_date);
    pstmt.setString(3,request.getParameter("pay_post"));
    pstmt.setString(4,request.getParameter("pay_narr"));
    pstmt.setString(5, request.getParameter("chq_no"));
    pstmt.setDate(6,chq_date);
    pstmt.setFloat(7,Float.parseFloat(request.getParameter("chq_amt")));
    pstmt.setString(8,request.getParameter("pay_type"));
    help me

  • Insert date in dd-mmm-yyyy format

    I have a jsp page, from that i can enter values in oracle database.
    my jsp page is working, but the problem is that it can only accept the date
    dd-mmm-yyyy format. i.e 20-jun-2004, but when i enter date in dd/mm/yyyy format i.e 20/06/2004, it does not accept.
    i want to enter to do enter date in dd/mm/yyyy format in the form, and it can save the date field in database in dd-mmm-yyyy format.
    my code is as bellow:
    <html>
    <body>
    <table>
    <tr>
    <td>
    <%@ page import =" java.sql.Date.*" %>
    <%@ page import =" java.text.SimpleDateFormat.*" %>
    <%@ page import =" java.util.Date.*" %>
    <%@ page import =" java.text.*" %>
    <%@ page import="javax.servlet.*" %>
    <%@ page import="javax.servlet.http.*" %>
    <%@ page language="java" import="java.sql.*" %>
    <%
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn=DriverManager.getConnection("jdbc:odbc:pf","scott","ttlscott");
    System.out.println("got connection");
    %>
    <%
    char pay_post,pay_type;
    String action = request.getParameter("action");
    if (action != null && action.equals("save")) {
    conn.setAutoCommit(false);
    PreparedStatement pstmt = conn.prepareStatement(
    ("INSERT INTO pay_header VALUES (?, ?, ?, ?, ?, ?,?,?)"));
    pstmt.setString(1,request.getParameter("vou_no"));
    pstmt.setString(2,request.getParameter("pay_date"));
    pstmt.setString(3,request.getParameter("pay_post"));
    pstmt.setString(4,request.getParameter("pay_narr"));
    pstmt.setString(5, request.getParameter("chq_no"));
    pstmt.setString(6,request.getParameter("chq_date"));
    pstmt.setFloat(7,Float.parseFloat(request.getParameter("chq_amt")));
    pstmt.setString(8,request.getParameter("pay_type"));
    pstmt.executeUpdate();
    conn.commit();
    conn.setAutoCommit(true);
    %>
    <%
    Statement statement = conn.createStatement();
    ResultSet rs = statement.executeQuery
    ("SELECT * FROM pay_header ");
    %>
    <tr>
    <form action="payment_save1.jsp" method="get">
    <input type="hidden" value="save" name="action">
    <th><input value="" name="vou_no" size="10"></th>
    <th><input value="" name="pay_date" size="10"></th>
    <th><input value="" name="pay_post" size="15"></th>
    <th><input value="" name="pay_narr" size="15"></th>
    <th><input value="" name="chq_no" size="15"></th>
    <th><input value="" name="chq_date" size="15"></th>
    <th><input value="" name="chq_amt" size="15"></th>]
    <th><input value="" name="pay_type" size="15"></th>
    <th><input type="submit" value="save"></th>
    </form>
    </tr>
    <%
    while ( rs.next() ) {
    %>
    <tr>
    <form action="payment_save1.jsp" method="get">
    <input type="hidden" value="save" name="action">
    <td><input value="<%= rs.getString("vou_no") %>" name="vou_no"></td>
    <td><input value="<%= rs.getDate("pay_date") %>" name="gl_descr"></td>
    <td><input value="<%= rs.getString("pay_post") %>" name="pay_post"></td>
    <td><input value="<%= rs.getString("pay_narr") %>" name="pay_narr"></td>
    <td><input value="<%= rs.getString("chq_no") %>" name="chq_no"></td>
    <td><input value="<%= rs.getDate("chq_date") %>" name="chq_date"></td>
    <td><input value="<%= rs.getFloat("chq_amt") %>" name="chq_amt"></td>
    <td><input value="<%= rs.getString("pay_type") %>" name="pay_type"></td>
    <td><input type="submit" value="save"></td>
    </form>
    </tr>
    <%
    %>
    </table>
    <%
    // Close the ResultSet
    rs.close();
    // Close the Statement
    statement.close();
    // Close the Connection
    conn.close();
    } catch (SQLException sqle) {
    out.println(sqle.getMessage());
    } catch (Exception e) {
    out.println(e.getMessage());
    %>
    </td>
    </tr>
    </body>
    </html>

    thanx for u r help..
    now i have used simple date format method and also apllied setDate() method.
    bit its coming error NULL
    code:
    SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yyyy");
    java.util.Date pay_date_temp = null;
    java.util.Date pay_post_temp = null;
    PreparedStatement pstmt = conn.prepareStatement(
    ("INSERT INTO pay_header VALUES (?, ?, ?, ?, ?, ?,?,?)"));
    java.sql.Date pay_date = new java.sql.Date(pay_date_temp.getTime());
    java.sql.Date chq_date = new java.sql.Date(pay_post_temp.getTime());
    pstmt.setString(1,request.getParameter("vou_no"));
    pstmt.setDate(2,pay_date);
    pstmt.setString(3,request.getParameter("pay_post"));
    pstmt.setString(4,request.getParameter("pay_narr"));
    pstmt.setString(5, request.getParameter("chq_no"));
    pstmt.setDate(6,chq_date);
    pstmt.setFloat(7,Float.parseFloat(request.getParameter("chq_amt")));
    pstmt.setString(8,request.getParameter("pay_type"));
    help me

  • How to convert XML data into binary data (opaque data)

    Hi,
    I am trying to develop a process that delivers files after reading data from a database.
    However, it is required not to deliver the data immediately. We want to perform some checks before the files get written.
    So the way we want to design this is,
    1. Read data from database (or any other input). The data is in XML format (this is a requirement, as in general, we have xml data)
    2. This data is written, opaquely, to a JMS queue that can store binary data, along with what is the filename of the file that would be written (filename is passed using JMS Headers)
    3. When required, another process reads the JMS queue's binary data, and dumps into a file
    The reason I want to use opaque data while inserting in the JMS queue is, that enables me to develop a single process in Step 3 that can write any file, irrespective of the format.
    My questions are
    1. How to convert the xml data to opaque data. In BPEL I may use a embedded java, but how about ESB. Any other way....?
    2. how to pass filename to the jms queue, when payload is opaque. Can I use a header attribute...custom attributes?
    3. Which jms message type is better for this kind of requirement - SYS.AQ$_JMS_BYTES_MESSAGE or SYS.AQ$_JMS_STREAM_MESSAGE

    Ana,
    We are doing the same thing--using one variable with the schema as the source of the .xsl and assigning the resulting html to another variable--the content body of the email, in our case. I just posted how we did it here: Re: Using XSLT to generate the email HTML body
    Let me know if this helps.

  • How to convert XMLTYPE data into CLOB without using getclobval()

    Please tell me how to convert data which is stored in the table in XMLTYPE column to a CLOB.
    When i use getClobVal(), i get an error. So please tell me some other option except getClobVal()

    CREATE OR REPLACE PACKAGE BODY CONVERT_XML_TO_HTML AS
         FUNCTION GENERATE_HTML(TABLE_NAME VARCHAR2, FILE_NAME VARCHAR2, STYLESHEET_QUERY VARCHAR2, WHERE_CLAUSE VARCHAR2, ORDERBY_CLAUSE VARCHAR2) RETURN CLOB IS
         lHTMLOutput XMLType;
         lXSL CLOB;
              lXMLData XMLType;
              FILEID UTL_FILE.FILE_TYPE;
              HTML_RESULT CLOB;
              SQL_QUERY VARCHAR2(300);
              WHERE_QUERY VARCHAR2(200);
              fileDirectory VARCHAR2(100);
              slashPosition NUMBER;
              actual_fileName VARCHAR2(100);
              XML_HTML_REF_CUR_PT XML_HTML_REF_CUR;
              BEGIN
                   IF WHERE_CLAUSE IS NOT NULL AND ORDERBY_CLAUSE IS NOT NULL THEN
                   SQL_QUERY := 'SELECT * FROM ' || TABLE_NAME ||' WHERE ' || WHERE_CLAUSE || ' ORDER BY ' || ORDERBY_CLAUSE;
                        ELSE IF WHERE_CLAUSE IS NOT NULL AND ORDERBY_CLAUSE IS NULL THEN
                             SQL_QUERY := 'SELECT * FROM ' || TABLE_NAME || ' WHERE ' || WHERE_CLAUSE;
                             ELSE IF WHERE_CLAUSE IS NULL AND ORDERBY_CLAUSE IS NOT NULL THEN
                                  SQL_QUERY := 'SELECT * FROM ' || TABLE_NAME || ' ORDER BY ' || ORDERBY_CLAUSE;
                                  ELSE IF WHERE_CLAUSE IS NULL AND ORDERBY_CLAUSE IS NULL THEN
                                  SQL_QUERY := 'SELECT * FROM ' || TABLE_NAME;
                   END IF;
                        END IF;
                             END IF;
                                  END IF;
                   OPEN XML_HTML_REF_CUR_PT FOR SQL_QUERY;
              lXMLData := GENERATE_XML(XML_HTML_REF_CUR_PT);
                   --lXSL := GET_STYLESHEET(STYLESHEET_QUERY);
                                  if(lXMLData is not null) then
                                  dbms_output.put_line('lXMLData pass');
                                  else
                                            dbms_output.put_line('lXMLData fail');
                   end if;
                   lHTMLOutput := lXMLData.transform(XMLType(STYLESHEET_QUERY));
                   --INSERT INTO TEMP_CLOB_TAB2 VALUES(CLOB(lHTMLOutput));
                   if(lHTMLOutput is not null) then
                                  dbms_output.put_line('lHTMLOutput pass');
                                  else
                                            dbms_output.put_line('lHTMLOutput fail');
                   end if;
                   HTML_RESULT := lHTMLOutput.getclobVal();
                   if(HTML_RESULT is not null) then
                                  dbms_output.put_line('HTML_RESULT pass'||HTML_RESULT);
                                  else
                                            dbms_output.put_line('HTML_RESULT fail');
                   end if;
                   -- If the filename has been supplied ...
         IF FILE_NAME IS NOT NULL THEN
    -- locate the final '/' or '\' in the pathname ...
         slashPosition := INSTR(FILE_NAME, '/', -1 );
         IF slashPosition = 0 THEN
         slashPosition := INSTR(FILE_NAME,'\', -1 );
         END IF;
    -- separate the filename from the directory name ...
         fileDirectory := SUBSTR(FILE_NAME, 1,slashPosition - 1 );
         actual_fileName := SUBSTR(FILE_NAME, slashPosition + 1 );
                   END IF;
                        DBMS_OUTPUT.PUT_LINE(fileDirectory||' ' ||actual_fileName);
                   FILEID := UTL_FILE.FOPEN(fileDirectory,actual_fileName, 'W');
                   UTL_FILE.PUT_LINE(FILEID, '<title> hi </title>');
              UTL_FILE.PUT_LINE(FILEID, HTML_RESULT);
                   UTL_FILE.FCLOSE (FILEID);
    DBMS_OUTPUT.PUT_LINE('CLOB SIZE'||DBMS_LOB.GETLENGTH(HTML_RESULT));               
                   RETURN HTML_RESULT;
                   --RETURN lHTMLOutput;
              EXCEPTION
                        WHEN OTHERS
                             THEN DBMS_OUTPUT.PUT_LINE('ERROR!!!!!!!!!!!!');
              END GENERATE_HTML;
         FUNCTION GENERATE_XML(XML_HTML_REF_CUR_PT XML_HTML_REF_CUR) RETURN XMLType IS
              qryCtx DBMS_XMLGEN.ctxHandle;
              result CLOB;
              result1 xmltype;
              BEGIN
                   qryCtx := DBMS_XMLGEN.newContext(XML_HTML_REF_CUR_PT);
                   result := DBMS_XMLGEN.getXML(qryCtx);
                   --dbms_output.put_line(result);
                   result1 := xmltype(result);
                   INSERT INTO temp_clob VALUES(result);
                   if(result1 is not null) then
                                  dbms_output.put_line('pass');
                                  else
                                            dbms_output.put_line('fail');
                   end if;
                        return result1;
                        DBMS_XMLGEN.closeContext(qryCtx);
         END GENERATE_XML;     
    END CONVERT_XML_TO_HTML;
    This is the code which i am using to generate the XML and subsequently to generate the HTML output out of that using a XSL stylesheet.
    The error is Numeric or value error..

  • How to convert blob data into clob using plsql

    hi all,
    I have requirement to convert blob column into clob .
    version details
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE     11.1.0.7.0     Production
    TNS for 32-bit Windows: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    DECLARE
       v_blob      temp.blob_column%TYPE;------this is blob data type column contains  (CSV file which is  inserted  from screens)
       v_clob      CLOB; --i want to copy blob column data into this clob
       v_warning   NUMBER;
    BEGIN
       SELECT blob_column
         INTO v_blob
         FROM temp
        WHERE pk = 75000676;
       DBMS_LOB.converttoclob (dest_lob          => v_clob,
                               src_blob          => v_blob,
                               amount            => DBMS_LOB.lobmaxsize,
                               dest_offset       => 1,
                               src_offset        => 1,
                               blob_csid         => 1, -- what  is the use of this parameter
                               lang_context      => 1,
                               warning           => v_warning
       DBMS_OUTPUT.put_line (v_warning);
    EXCEPTION
       WHEN OTHERS
       THEN
          DBMS_OUTPUT.put_line (SQLCODE);
          DBMS_OUTPUT.put_line (SQLERRM);
    END;I am not getting what is the use of blob_csid , lang_context parameters after going the trough the documentation .
    Any help in this regard would be highly appreciated .......
    Thanks
    Edited by: prakash on Feb 5, 2012 11:41 PM

    Post the 4 digit Oracle version.
    Did you read the Doc for DBMS_LOB.CONVERTTOCLOB? - http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_lob.htm
    The function can convert data from one character set to another. If the source data uses a different character set than the target you need to provide the character set id of the source data.
    The blob_csid parameter is where you would provide the value for the source character set.
    If the source and target use the same character set then just pass zero. Your code is passing a one.
    >
    General Notes
    You must specify the character set of the source data in the blob_csid parameter. You can pass a zero value for blob_csid. When you do so, the database assumes that the BLOB contains character data in the same character set as the destination CLOB.
    >
    Same for 'lang_context' - your code is using 1; just use 0. It is an IN OUT
    >
    lang_context
    (IN) Language context, such as shift status, for the current conversion.
    (OUT) The language context at the time when the current conversion is done.
    This information is returned so you can use it for subsequent conversions without losing or misinterpreting any source data. For the very first conversion, or if do not care, use the default value of zero.

  • How to convert the date in mm/dd/yyyy.

    hi,
    I am working with tcurr tables when i go in se16 and see the table i see the field gdatu in '79929474'.
    if i double click on the that particular row the format of gdatu changes to '25.05.2007'.
    I am working on an extract and the date is coming in  '79929474'. I need to convert it to mm/dd/yyyy format.
    I need ur help and guidence.
    Kamlesh

    Hi Kamlesh
    Try to execute the program and see the result.The same logic can be used for solving your date issue.
    TABLES :tcurr.
    TYPES:BEGIN OF g_ty_tcurr.
            INCLUDE STRUCTURE tcurr.
    TYPES: date TYPE sy-datum.
    TYPES: END OF g_ty_tcurr.
    DATA : it_tcurr TYPE TABLE OF g_ty_tcurr,
           wa_tcurr LIKE LINE OF  it_tcurr.
    SELECT *  FROM tcurr INTO CORRESPONDING FIELDS OF TABLE it_tcurr.
    LOOP AT  it_tcurr INTO  wa_tcurr.
      DATA:wrk_date(10) TYPE c.
      CALL FUNCTION 'CONVERSION_EXIT_INVDT_OUTPUT'
        EXPORTING
          input  = wa_tcurr-gdatu
        IMPORTING
          output = wrk_date.
      CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
        EXPORTING
          date_external            = wrk_date
        IMPORTING
          date_internal            = wrk_date
        EXCEPTIONS
          date_external_is_invalid = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      DATA: wrk_date1 TYPE sy-datum.
      CONCATENATE wrk_date4(2) wrk_date6(2) wrk_date+0(4) INTO wrk_date1.  " to get teh date in mmddyyyy format.
      wa_tcurr-date = wrk_date1.
      MODIFY it_tcurr FROM wa_tcurr TRANSPORTING date.
    ENDLOOP.

  • Convert system date to MM/dd/yyyy

    Hi,
    I have to insert system date(current date) to MS Access database which contains colums in MM/dd/yyyy. Can you tell me how can i do it?
    --Ramesh.N                                                                                                                                                                                                                                                                                                                           

    String getDate() {
              Date theDate = new Date();
              SimpleDateFormat newForm = new SimpleDateFormat("MM/dd/yyyy");
              String date =  newForm.format(theDate);
              return date;
         }Try that

  • How to convert exponential data into number for the downloaded excelsheet

    Hi
    I have downloaded one field data i.e. having char of 50,  into excel sheet and it is displaying as  exponential in the excel sheet. 
    The data numbers should display as text only i.e 1236547896321 and not exponential
    Is anyone can tell how we can do this
    Thanks
    Pallavi

    Hello Pallvai,
    The problem of exponential is with the excel. Excel converts the large numbet into exponential.
    To avoid this you can make the number into text then excel won't convert it into exponential.
    For that you can do a simple trick. Just prefix a single quote ( ' ) in the field.
    eg:
    field = 1236547896321.
    then,
    constants c_quote type c value '''.   "<-- single quote
    concatenate c_quote field into field.
    " This will make the EXCEL to consider this field as text not number and hence it will not be considered
    " as exponential.
    Hope this solves your problem.
    Regards,
    Sachinkumar Mehta

  • How to convert raw data into pdf ?

    Hi everyone,
    I have a requirement where I have to print the document present in application server.
    I used below code to do this
    * Open the file in binary mode
       OPEN DATASET gv_filepath FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS.
       DO.
         TRY.
    * Since the file is opened in Binary mode, the entire contents of the
    * file is read in one go!
             READ DATASET gv_filepath INTO gv_filedata.
             IF sy-subrc <> 0.
               EXIT.
             ENDIF.
           CATCH cx_sy_conversion_codepage.
         ENDTRY.
         APPEND gv_filedata TO gt_file_table.
         CLEAR gv_filedata.
       ENDDO.
       CLOSE DATASET gv_filepath.
    DESCRIBE TABLE gt_file_table LINES lv_lines.
      lv_pages = lv_lines.
      lv_dest = 'LP01'.
      lv_spoolname = 'LOCW'.
      CALL FUNCTION 'RSPO_SX_OUTPUT_TEXTDATA'
        EXPORTING
    *     NAME           = lv_spoolname
          DEST           = lv_dest
          ROWS           = lv_lines
          STARTROW       = 1
          PAGES          = 99
          RQTITLE        = 'Print Spool'
          RQCOPIES       = 1
          RQOWNER        = sy-uname
          IMMEDIATELY    = ' '
        IMPORTING
          RQID           = lv_spoolid
        TABLES
          TEXT_DATA      = gt_file_table
        EXCEPTIONS
          NAME_MISSING   = 1
          NAME_TWICE     = 2
          NOT_FOUND      = 3
          ILLEGAL_LAYOUT = 4
          INTERNAL_ERROR = 5
          SIZE_MISMATCH  = 6
          OTHERS         = 7.
      IF SY-SUBRC <> 0.
    * Implement suitable error handling here
      ENDIF.
    Passed the spool id generated to below FM but it is not converting into pdf
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          SRC_SPOOLID                    = lv_spoolid
         NO_DIALOG                      = ' '
         DST_DEVICE                     = 'LOCW'
         PDF_DESTINATION                = 'X'
    *     NO_BACKGROUND                  =
    *     GET_SIZE_FROM_FORMAT           =
    *     USE_CASCADING                  = ' '
    *   IMPORTING
    *     PDF_BYTECOUNT                  = lv_bytecount
    *     PDF_SPOOLID                    = lv_pdf1
    *     LIST_PAGECOUNT                 =
    *     BTC_JOBNAME                    =
    *     BTC_JOBCOUNT                   =
    *     BIN_FILE                       = lv_pdf
       TABLES
         PDF                            = lt_pdf
       EXCEPTIONS
         ERR_NO_ABAP_SPOOLJOB           = 1
         ERR_NO_SPOOLJOB                = 2
         ERR_NO_PERMISSION              = 3
         ERR_CONV_NOT_POSSIBLE          = 4
         ERR_BAD_DESTDEVICE             = 5
         USER_CANCELLED                 = 6
         ERR_SPOOLERROR                 = 7
         ERR_TEMSEERROR                 = 8
         ERR_BTCJOB_OPEN_FAILED         = 9
         ERR_BTCJOB_SUBMIT_FAILED       = 10
         ERR_BTCJOB_CLOSE_FAILED        = 11
         OTHERS                         = 12
      IF SY-SUBRC <> 0.
    * Implement suitable error handling here
      ENDIF.
    When I go to SP01 and check the spool generated it is in raw document type.
    How can I convert this raw document to pdf type ??
    Please help me to resolve this.
    Regards,
    Krishna

    Ok, since I can't edit the post anymore, here the new version of code, without the use of SCMS_XSTRING_TO_BINARY for intermediate table. Reasons: effectively doubles the memory use and I don't want to check if the kernel is cutting off the hexdecimal nulls when the last spool line is written, or to relay of that behaviour.
    Matthew Billingham, and other mods: it would be really nice if you could hide the old version please (this post here). The number of google results for that FM is scary and I really don't want to contribute to promoting its use...
    REPORT zjbtst2.
    PARAMETERS: p_file TYPE string
       LOWER CASE
       DEFAULT '/usr/sap/....'
       OBLIGATORY.
    PARAMETERS: p_dest TYPE rspopname
      DEFAULT 'LP01'
      OBLIGATORY .
    PERFORM main USING p_file p_dest.
    *&      Form  main
    FORM main
      USING
        i_file TYPE string
        i_dest TYPE  rspopname.
      DATA: lo_handle TYPE REF TO cl_rspo_spool_handle .
      DATA: l_spoolid TYPE rspoid.
      DATA: l_content TYPE xstring .
      DATA: l_message_text TYPE string .
      PERFORM get_file USING i_file CHANGING l_content .
      PERFORM new_spool USING i_dest CHANGING lo_handle l_spoolid.
      PERFORM write_spool USING lo_handle l_spoolid l_content .
      l_message_text = |Spool { l_spoolid } created| .
      MESSAGE l_message_text TYPE 'I' .
    ENDFORM .                  "main
    *&      Form  get_file
    FORM get_file
       USING i_file TYPE string
       CHANGING c_content TYPE xstring.
      DATA: l_message_text TYPE string .
      CLEAR c_content .
      OPEN DATASET i_file FOR INPUT IN BINARY MODE
        MESSAGE l_message_text.
      IF sy-subrc NE 0 .
        MESSAGE l_message_text TYPE 'E' .
      ELSE.
        READ DATASET i_file INTO c_content .
        CLOSE DATASET i_file.
      ENDIF .
    ENDFORM .                   "get_file
    *&      Form  new_spool
    FORM new_spool
       USING
         i_destination TYPE rspopname
       CHANGING
         co_handle TYPE REF TO cl_rspo_spool_handle
         c_spoolid TYPE rspoid .
      cl_rspo_spool_handle=>open(
        EXPORTING
          dest           = i_destination
          name           = 'Test'
          layout         = 'G_RAW'
          doctype        = 'BIN'
        IMPORTING
          ref            = co_handle
          spoolid        = c_spoolid
        EXCEPTIONS
          device_missing = 1
          name_twice     = 2
          no_such_device = 3
          operation_failed = 4
          OTHERS         = 5
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM .                    "new_spool
    *&      Form  WRITE_SPOOL
    FORM write_spool
      USING
        io_handle TYPE REF TO cl_rspo_spool_handle
        i_spoolid TYPE rspoid
        i_content TYPE xstring .
      DATA: l_buffer(128) TYPE x ."Hmm, 128 does work, 4096 doesn't...
      DATA: l_buffer_length TYPE i .
      DATA: l_full_buffers_count TYPE i .
      DATA: l_part_buffer_length TYPE i .
      DATA: l_offset TYPE i .
      DATA: l_length TYPE i .
      l_buffer_length = xstrlen( l_buffer ) .
      l_full_buffers_count = xstrlen( i_content ) DIV l_buffer_length .
      l_part_buffer_length = xstrlen( i_content ) MOD l_buffer_length .
      DO l_full_buffers_count + 1 TIMES .
        IF sy-index LE l_full_buffers_count .
          l_length = l_buffer_length .
        ELSEIF l_part_buffer_length GT 0 .
          l_length = l_part_buffer_length .
        ELSE.
          EXIT .
        ENDIF .
        l_buffer = i_content+l_offset(l_length) .
        ADD l_length TO l_offset .
        io_handle->write_binary(
          EXPORTING
            data           = l_buffer
            length         = l_length
          EXCEPTIONS
            not_open       = 1
            operation_failed = 2
            OTHERS         = 3
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDDO .
      io_handle->close(
        EXPORTING
          final          = 'X'
        EXCEPTIONS
          operation_failed = 1
          already_closed = 2
          OTHERS         = 3
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM .                    "write_spool

Maybe you are looking for