Displaying keyword search results 1 - 11
Created by Dr. Xi on February 18, 2010 20:39:59 Last update: February 18, 2010 20:41:17
Oracle provides two functions for string replacement: REPLACE and TRANSLATE . REPLACE replaces one substring with another:
-- Replace John with Bob select REPLACE('Hello ...TRANSLATE replaces one character by another, position for position:
-- rot13 in Oracle SQL select TRANSLATE('Hello ...
Created by Dr. Xi on January 07, 2010 23:51:44 Last update: January 07, 2010 23:53:57
This is a utility to generate a "create synonym" script for Oracle for an existing schema.
import java.io.*; import java.sql.*; pub...
Created by Dr. Xi on October 09, 2009 19:27:22 Last update: October 09, 2009 19:30:01
PL/SQL code from Pandazen :
CREATE OR REPLACE FUNCTION GET_INSERT_SCRIPT(V_TAB...Usage: To create the script for generating the INSERT statements:
set head off set pages 0 set trims on set...Run the resulting script to generate the INSERT script:
set pages 0 set trims on set lines 2000 ...PL/SQL code from Oracle Ask Tom
set serveroutput on size 100000 set feedbac...
Created by Dr. Xi on September 05, 2007 22:33:13 Last update: July 28, 2009 23:33:36
Create a synonym:
-- create a private synonym CREATE SYNONYM emp ...Remove a synonym:
-- Drop public synonym DROP PUBLIC SYNONYM emp;...View synonyms:
select * from dba_synonyms where TABLE_OWNER = 'SC...
Created by Dr. Xi on October 30, 2008 03:39:50 Last update: October 30, 2008 03:40:51
-- define types CREATE OR REPLACE TYPE pers...
Created by Dr. Xi on October 30, 2008 03:14:15 Last update: October 30, 2008 03:15:03
-- create person type CREATE OR REPLACE TYP...
Created by Dr. Xi on October 24, 2008 22:24:46 Last update: October 24, 2008 22:24:46
This script creates a PL/SQL script to recreate currently defined oracle jobs. Good for exporting jobs definitions from one instance and import into another instance, or as a master script to create job definitions from scratch.
declare what user_jobs.what%TYPE; interv...
Created by Dr. Xi on October 24, 2008 21:50:23 Last update: October 24, 2008 21:51:38
-- spec create or replace package Email as ...
Created by Dr. Xi on September 11, 2008 03:21:28 Last update: September 11, 2008 03:21:28
Create a procedure like this:
CREATE OR REPLACE PROCEDURE sp_mytest(p1 IN VARCHA...You can call it from SQL*Plus like this:
sql>var v_result number sql>exec sp_mytest('a',...
Created by Dr. Xi on September 11, 2008 03:04:14 Last update: September 11, 2008 03:10:31
-- with IN parameter CREATE OR REPLACE PROC...
Created by Dr. Xi on April 06, 2008 15:17:03 Last update: September 06, 2008 17:18:07
If you create a model like the following:
from django.db import models class Person(m...Django creates the corresponding table like this:
CREATE TABLE person ( "id" number(11,0) NOT...Since Oracle doesn't have IDENTITY or AUTO_INCREMENT column, how does Django create the primary key when you insert a new person? In fact, when you run python manage.py syncdb with an empty database, Django also creates a sequence and a trigger:
create sequence person_sq; create or replace TR...However, if you have an existing Person table and are creating a Django model for it, the sequence and trigger won't be created when you syncdb . You have to manually create them in order for inserts to work.