1. The following steps: Start key--Enter run-in Sqlplus enter username: sys input password: SYS as SYSDBA//NOTE: The password entered here must follow the as SYSDBA. sql> alter user Scott account unlock; The user has changed. Sql> commit; Submit complete. Sql> Conn Scott/tiger change Scott password new password: Tiger Retype the new password: Tiger password changed connected. Complete.
2.//View the global database name
SELECT * from Global_name;
3.//oracle build table Set Primary key auto-increment
First create a table
CREATE TABLE member (MemberID number primary key, Membermail varchar2 () not NULL, MemberName VARCHAR2 (a) not NULL, Membe Rpassword varchar2 (20)); Then, you need a custom sequence
CREATE SEQUENCE emp_sequence INCREMENT by 1--add several start with 1 each--counting from 1 nomaxvalue--not setting maximum nocycle--always accumulating, not looping NOCAC HE--Do not build buffers you only have tables and sequences that are not enough, and you need a trigger to execute it! The code is as follows:
Create trigger Mem_trig before insert on member for each row if (New.memberid is null) BEGIN select Emp_sequence.next Val into:new.memberId from dual; End
So you can, insert data test INSERT INTO member (Membermail,membername,memberpassword) VALUES ('[email protected]', ' Jack ', ' 123456 ');
4.//Open the connection oracleconnection connection = new OracleConnection ("Server=ora; User Id=scott; Password = Tiger; "); Connection. Open (); Create a command oraclecommand command = new OracleCommand (); Command. Connection = Connection; Set the CommandType property to execute//stored procedures or functions by this command command. CommandType = System.Data.CommandType.StoredProcedure; Set the name of procedure or function to is executed command. CommandText = "Get_all_depts_proc"; The Parametercheck property should is true to automatically//check the parameters needed for the procedure execution. Command. Parametercheck = true; At this moment, the command was ready for execution. As we have an output cursor parameter, we could use the command to fill a data table. Oracledatatable dt = new oracledatatable (command, connection); Dt. Fill ();
Oracle Installation Basics