Saturday 29 March 2014

Insert string with apostrophe(') in sql

when using Insert statement to inset string type fields and the values has an apostrophe('), how

the inset statements can be handled in such cases.


SQL> insert into donuts values('jelly's,9);
insert into donuts values('jelly's,9)
                                   *
ERROR at line 1:
ORA-00917: missing comma


SQL> insert into donuts values('jelly''s,9);
ERROR:
ORA-01756: quoted string not properly terminated

The Error displayed here is due to string data types that are delimited by the single quotation mark and the apostrophe(') is considered as the end of the string  delimiter.

The possible way is to escape single apostrophe (') with an extra apostrophe as below.


SQL> insert into donuts values('jelly''s',9);

1 row created.

Now the string with apostrophe is inserted into the table.

SQL> select * from donuts;


NAME PRICE
---------- ----------
jelly 9
jell's 9


Monday 24 March 2014

count tables for each user in oracle database

sql query to count no of tables owned by each user in oracle database


SELECT COUNT(*), owner  FROM ALL_TABLES group by owner;


SQL> SELECT COUNT(*), owner  FROM ALL_TABLES group by owner;
  COUNT(*) OWNER
---------- ------------------------------
        39 WIN
        39 REDON
      121 PANK
    3456 ANA
        32 MONK
        72 PAT
        93 GREF
    3456 CHIN
        10 KILM
        20 BLOG
      155 SYSTEM
   
11 rows selected.
 

Saturday 22 March 2014

Exception in thread "main" java.lang.AssertionError: Subclass must override this method


Exception in thread "main" java.lang.AssertionError: Subclass must override this method

   at java.lang.reflect.AccessibleObject.getAnnotation(libgcj.so.7rh)

   at org.kohsuke.args4j.ClassParser.parse(ClassParser.java:21)
   at org.kohsuke.args4j.CmdLineParser.<init>(CmdLineParser.java:91)
   at hudson.remoting.Launcher.main(Launcher.java:170)
To overcome this on launching slave.jar as part of jekins setup, try using latest java version.
This should be solved on using the latest java versions.