Posts

Showing posts with the label oracle

Using Oracle 11g thru VirtualBox appliance in Mac OS X Lion

Image
I just found that its quite a lot of handy work to make Oracle work in Mac OS X Lion. Currently, I have this quite cool machine with good memory anyway, so I decided to step the easy way, than the "too-much-time-to-work way". So, I just decided to use VirtualBox with Oracle's pre-built virtual appliance with Oracle 11g Enterprise Edition. To use this, I use the steps below. 1. Download VirtualBox at http://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html 2. Download the virtual appliances at http://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html then just follow the steps. 3. I added some specific ports, since I access it thru  NAT so whenever I am, it's easier for me just to hook up my virtual appliance and turn it on. So you can issue these command in your terminal, $> VBoxManage modifyvm "OTN Developer Days" --natpf1 "ssh,tcp,,2222,,22" $> VBoxManag...

Quickest way to create a table in Oracle

I found this very easy and quick to create a table, though sort of copy a table to another table. The syntax is: create table table_to_create as select * from source_table where 1=0 Hope you find this a little bit of help.

ORA-20000: ORU-10027: buffer overflow, limit of 2000 bytes

The solutions for that error is to specify thru DBMS_OUTPUT.ENABLE(10000). Note that the default value is 2000 characters, and maximum is 1, 000, 000.

Oracle - Get the last inserted id how-to

Just simple, declare a variable with that type, mostly number, then   use the 'returning' syntax   for that. set serveroutput on declare  nr_id number; begin  insert into employees( id, name, age )  values( seq_employees.NEXTVAL, 'Jones', 33 )  returning id into nr_id;  dbms_output.put_line( 'nr_id = ' || nr_id ); end; / Hope this helps.  - Toytoy Gogie

Oracle - Create auto-increment equivalent in MySQL

So for example, I have my table below to create CREATE TABLE "PC2"."TMP_PRODUCT" (   "ID"              NUMBER(38,0) NOT NULL ENABLE,   "ACCOUNTCODE"     VARCHAR2(20 BYTE),   "PRICESEGMENT"    VARCHAR2(20 BYTE),   "BRAND"           VARCHAR2(20 BYTE),   "PRODUCTLENGTH"   NUMBER,   "SALESID"  NUMBER(38,0),   CONSTRAINT "PK_TMP2_WPP_1009_ID" PRIMARY KEY ("ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255,   CONSTRAINT "FK_TMP2_WPP_1009_SID" FOREIGN KEY ("SALESID") REFERENCES "PC2"."SALES" ("ID") DEFERRABLE INITIALLY DEFERRED ENABLE ); Then create a sequence which would manage the incremental part of the index key. CREATE SEQUENCE SEQ_TMP_PRODUCT   START WITH 1 INCREMENT BY 1; Afterwards, create a trigger which what will do is to insert the incremented key of the table. CREATE OR REPLACE TR...

Tunneling Oracle For Port 1521 From Other Server

This set up is that, I cannot open the 1521 if I do directly from the outside host to my SQLDeveloper, so what I did, I tunnel to port 1521 by opening port 1525 to forward it to 1521 to that host I wanted to logged in. Basically, I can login to that system with my ssh account. So the command I did was: ssh -L 1525:localhost:1521 username@your-host.com Where 1525 is your local port to open and 1521 is the port you're going to tunnel, which is the default port for Oracle. For some ways, you can also port forwarding like to port 80, port 110, or IRC ports like 6667-6669. Hope this helps.

Oracle DB - Get the constraints information from a table

I'm beginning now to use Oracle fro development, now expect that I'll be having more SELECT table_name, column_name, CONSTRAINT_NAME FROM all_cons_columns WHERE owner='username_owner' AND constraint_name='UK_CONSTRAINTNAME' ORDER BY position; where UK_CONSTRAINTNAME is a constraintname that you named like UK_USERSPROFILE or UK_USERSPROFILE_FIRSTNAME.