Академический Документы
Профессиональный Документы
Культура Документы
NUMBER (5)
NOT NULL,
USERNAME
CREATED_BY
CREATED_DATE DATE
NOT NULL,
COMMIT;
END;
/
3. Calls from PL/SQL
Call from PL/SQL like this :
BEGIN
insertDBUSER(1001,'mkyong','system',SYSDATE);
END;
NUMBER (5)
NOT NULL,
USERNAME
CREATED_BY
CREATED_DATE DATE
NOT NULL,
2. Stored Procedure
A stored procedure, accept 2 IN parameters and update the username field based
on the provided userId.
CREATE OR REPLACE PROCEDURE updateDBUSER(
p_userid IN DBUSER.USER_ID%TYPE,
p_username IN DBUSER.USERNAME%TYPE)
IS
BEGIN
COMMIT;
END;
/
updateDBUSER(1001,'new_mkyong');
END;
NUMBER (5)
NOT NULL,
USERNAME
CREATED_BY
CREATED_DATE DATE
NOT NULL,
2. Stored Procedure
A stored procedure, delete the record base on the provided userId.
CREATE OR REPLACE PROCEDURE deleteDBUSER(p_userid IN DBUSER.USER_ID%TYPE)
IS
BEGIN
COMMIT;
END;
/
Result
Record of userid=1001 is deleted via deleteDBUSER store procedure.
NUMBER (5)
NOT NULL,
USERNAME
CREATED_BY
CREATED_DATE DATE
PRIMARY KEY ( USER_ID )
)
NOT NULL,
2. Stored Procedure
A stored procedure, uses SELECT INTO mechanism to assign the matched values to
OUT parameters.
CREATE OR REPLACE PROCEDURE getDBUSERByUserId(
p_userid IN DBUSER.USER_ID%TYPE,
o_username OUT DBUSER.USERNAME%TYPE,
o_createdby OUT DBUSER.CREATED_BY%TYPE,
o_date OUT DBUSER.CREATED_DATE%TYPE)
IS
BEGIN
END;
/
o_date DBUSER.CREATED_DATE%TYPE;
BEGIN
getDBUSERByUserId(1001,o_username,o_createdby,o_date);
END;
/
Result
Record with userId=1001 is displayed via getDBUSERByUserId store procedure.
RETURN NUMBER
IS acc_bal NUMBER(11,2);
BEGIN
SELECT balance
INTO acc_bal
FROM accounts
WHERE account_id = acc_no;
RETURN(acc_bal);
END;
The GET_BAL function returns the balance of a specified account.
When you call the function, you must specify the argument ACC_NO, the number of the account whose
balance is sought. The datatype of ACC_NO is NUMBER.
The function returns the account balance. The RETURN clause of the CREATE FUNCTION statement
specifies the datatype of the return value to be NUMBER.
The function uses a SELECT statement to select the BALANCE column from the row identified by the
argument ACC_NO in the ACCOUNTS table. The function uses a RETURN statement to return this value
to the environment in which the function is called.
The function created above can be used in a SQL statement. For example:
SELECT get_bal(100) FROM DUAL;
The following statement creates PL/SQL standalone function GET_VAL that registers the C routine
C_GET_VAL as an external function. (The parameters have been omitted from this example.)
CREATE FUNCTION get_val
( x_val IN NUMBER,
y_val IN NUMBER,
image IN LONG RAW )
RETURN BINARY_INTEGER AS LANGUAGE C
NAME "c_get_val"
LIBRARY c_utils
PARAMETERS (...);
http://www.compiletimeerror.com/2013/12/content-provider-inandroid.html
http://developer.android.com/guide/topics/providers/content-providercreating.html
https://newcircle.com/s/post/1375/android_content_provider_tutorial
http://code.tutsplus.com/tutorials/android-fundamentals-working-withcontent-providers--mobile-5549